2020-10-19 13:19:24 -07:00
|
|
|
pub use solana_program_sdk::entrypoint::*;
|
2019-09-06 17:32:14 -07:00
|
|
|
|
2019-05-21 13:39:27 -07:00
|
|
|
#[macro_export]
|
2020-10-19 13:19:24 -07:00
|
|
|
#[deprecated(
|
|
|
|
since = "1.4.3",
|
|
|
|
note = "use solana_program_sdk::entrypoint::entrypoint instead"
|
|
|
|
)]
|
2019-05-21 13:39:27 -07:00
|
|
|
macro_rules! entrypoint {
|
|
|
|
($process_instruction:ident) => {
|
2020-10-06 11:03:51 -07:00
|
|
|
#[cfg(all(not(feature = "custom-heap"), not(test)))]
|
|
|
|
#[global_allocator]
|
|
|
|
static A: $crate::entrypoint::BumpAllocator = $crate::entrypoint::BumpAllocator {
|
|
|
|
start: $crate::entrypoint::HEAP_START_ADDRESS,
|
|
|
|
len: $crate::entrypoint::HEAP_LENGTH,
|
|
|
|
};
|
|
|
|
|
2020-01-03 09:14:28 -08:00
|
|
|
/// # Safety
|
2019-05-21 13:39:27 -07:00
|
|
|
#[no_mangle]
|
2020-01-31 10:58:07 -08:00
|
|
|
pub unsafe extern "C" fn entrypoint(input: *mut u8) -> u64 {
|
2020-01-30 09:47:22 -08:00
|
|
|
let (program_id, accounts, instruction_data) =
|
|
|
|
unsafe { $crate::entrypoint::deserialize(input) };
|
|
|
|
match $process_instruction(&program_id, &accounts, &instruction_data) {
|
|
|
|
Ok(()) => $crate::entrypoint::SUCCESS,
|
|
|
|
Err(error) => error.into(),
|
2019-05-21 13:39:27 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|