transfer_lamports_anchor

Macro transfer_lamports_anchor 

Source
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

  1. The from account must be owned by the executing program.
  2. Both accounts must be marked mut.
  3. The total lamports before the transaction must equal to total lamports after the transaction.
  4. lamports field of both account infos should not currently be borrowed.

§Examples

ⓘ
transfer_lamports_anchor!(
 ctx.accounts.from_account,
 ctx.accounts.to_account,
 amount,
);