1

https://solscan.io/tx/5FeGPX14zLB3vYoJKSGa8miKSj7hRicmZAacmkb7GJocx2Q6PE7Sazrz6tTzotJZ6oBiKm6XYF3zoVnG6FoqHodn

The transaction has instructions for paying fee and swapping the SPL token back into the bonding curve. And the user's account did have sol increased and the bonding curve decreased from the sol balance change. But I can't see any instructions to do the transfer.

1 Answer 1

1

The withdrawal must be happening from a program-owned account. As such this isn't a traditional transfer IX that's being called but the authority of an account manipulating its lamport balance.

Check out a similar transaction here, where our WithdrawSol works by modifying the escrow account.

code-wise

As noted, the account you are mutating must be marked as mut in Anchor

#[account(mut)]
pub wallet: Account<'info, Wallet>,

Also, to note, the sub_lamports methods are available from version 0.29.0

 // transfer amount from program-owned `wallet` account to receiver 
 wallet.sub_lamports(amount)?; 
 ctx.accounts.receive.add_lamports(amount)?;
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.