Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_runtime_program_fd_system_program_h 2 : #define HEADER_fd_src_flamenco_runtime_program_fd_system_program_h 3 : 4 : #include "../../fd_flamenco_base.h" 5 : #include "../../types/fd_types.h" 6 : 7 : /* Custom error types */ 8 : 9 0 : #define FD_SYSTEM_PROGRAM_ERR_ACCT_ALREADY_IN_USE (0) /* SystemError::AccountAlreadyInUse */ 10 0 : #define FD_SYSTEM_PROGRAM_ERR_RESULT_WITH_NEGATIVE_LAMPORTS (1) /* SystemError::ResultWithNegativeLamports */ 11 : #define FD_SYSTEM_PROGRAM_ERR_INVALID_PROGRAM_ID (2) /* SystemError::InvalidProgramId */ 12 0 : #define FD_SYSTEM_PROGRAM_ERR_INVALID_ACCT_DATA_LEN (3) /* SystemError::InvalidAccountDataLength */ 13 : #define FD_SYSTEM_PROGRAM_ERR_MAX_SEED_LEN_EXCEEDED (4) /* SystemError::MaxSeedLengthExceeded */ 14 0 : #define FD_SYSTEM_PROGRAM_ERR_ADDR_WITH_SEED_MISMATCH (5) /* SystemError::AddressWithSeedMismatch */ 15 0 : #define FD_SYSTEM_PROGRAM_ERR_NONCE_NO_RECENT_BLOCKHASHES (6) /* SystemError::NonceNoRecentBlockhashes */ 16 0 : #define FD_SYSTEM_PROGRAM_ERR_NONCE_BLOCKHASH_NOT_EXPIRED (7) /* SystemError::NonceBlockhashNotExpired */ 17 : #define FD_SYSTEM_PROGRAM_ERR_NONCE_UNEXPECTED_BLOCKHASH_VALUE (8) /* SystemError::NonceUnexpectedBlockhashValue */ 18 : 19 0 : #define FD_SYSTEM_PROGRAM_NONCE_DLEN (80UL) 20 : 21 : FD_PROTOTYPES_BEGIN 22 : 23 : /* fd_system_program_execute is the entrypoint for the system program */ 24 : 25 : int fd_system_program_execute( fd_exec_instr_ctx_t * ctx ) ; 26 : 27 : /* System program instruction handlers */ 28 : 29 : int fd_system_program_exec_create_account ( fd_exec_instr_ctx_t * ctx, fd_system_program_instruction_create_account_t const * data ); 30 : int fd_system_program_exec_assign ( fd_exec_instr_ctx_t * ctx, fd_pubkey_t const * owner ); 31 : int fd_system_program_exec_transfer ( fd_exec_instr_ctx_t * ctx, ulong lamports ); 32 : int fd_system_program_exec_create_account_with_seed( fd_exec_instr_ctx_t * ctx, fd_system_program_instruction_create_account_with_seed_t const * data ); 33 : int fd_system_program_exec_advance_nonce_account ( fd_exec_instr_ctx_t * ctx ); 34 : int fd_system_program_exec_withdraw_nonce_account ( fd_exec_instr_ctx_t * ctx, ulong lamports ); 35 : int fd_system_program_exec_initialize_nonce_account( fd_exec_instr_ctx_t * ctx, fd_pubkey_t const * pubkey ); 36 : int fd_system_program_exec_authorize_nonce_account ( fd_exec_instr_ctx_t * ctx, fd_pubkey_t const * pubkey ); 37 : int fd_system_program_exec_allocate ( fd_exec_instr_ctx_t * ctx, ulong space ); 38 : int fd_system_program_exec_allocate_with_seed ( fd_exec_instr_ctx_t * ctx, fd_system_program_instruction_allocate_with_seed_t const * data ); 39 : int fd_system_program_exec_assign_with_seed ( fd_exec_instr_ctx_t * ctx, fd_system_program_instruction_assign_with_seed_t const * data ); 40 : int fd_system_program_exec_transfer_with_seed ( fd_exec_instr_ctx_t * ctx, fd_system_program_instruction_transfer_with_seed_t const * data ); 41 : int fd_system_program_exec_upgrade_nonce_account ( fd_exec_instr_ctx_t * ctx ); 42 : 43 : /* User APIs */ 44 : 45 : /* fd_check_transaction_age returns 0 if the transactions age is 46 : valid, returns non-zero otherwise. This is determined by the age of 47 : the blockhash provided in the transaction message or by the 48 : validity of the nonce provided in the transaction. */ 49 : 50 : int 51 : fd_check_transaction_age( fd_exec_txn_ctx_t * txn_ctx ); 52 : 53 : FD_PROTOTYPES_END 54 : 55 : #endif /* HEADER_fd_src_flamenco_runtime_program_fd_system_program_h */