macro_rules! transfer_lamports_anchor {
($from:expr, $to:expr, $amount:expr) => { ... };
}Expand description
Macro for transferring lamports between accounts that implement the Lamports trait
§Requirements
- The
fromaccount must be owned by the executing program. - Both accounts must be marked
mut. - The total lamports before the transaction must equal to total lamports after the transaction.
lamportsfield of both account infos should not currently be borrowed.
§Examples
ⓘ
transfer_lamports_anchor!(
ctx.accounts.from_account,
ctx.accounts.to_account,
amount,
);