Skip to content

Instantly share code, notes, and snippets.

@alecchendev
Created April 9, 2022 03:17
Show Gist options
  • Save alecchendev/591c174285f3cbc36df95203ddf20f4d to your computer and use it in GitHub Desktop.
Save alecchendev/591c174285f3cbc36df95203ddf20f4d to your computer and use it in GitHub Desktop.
// get accounts
let accounts_iter = &mut accounts.iter();
let ribbon_account = next_account_info(&accounts_iter)?;
// serialize
let ribbon_data = RibbonAccount { // random struct, idk how I thought of this
length: 10,
color: 3
};
ribbon_data.serialize(&mut *ribbon_account.try_borrow_mut_data()?)?;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment