Skip to content

Instantly share code, notes, and snippets.

View milk-duds-pro's full-sized avatar

Milk Duds Professional 64-Bit milk-duds-pro

View GitHub Profile
@milk-duds-pro
milk-duds-pro / multi-structure-account-anchor.rs
Created December 5, 2021 21:29
an example showing that 1 account can have multiple different data structures
use anchor_lang::prelude::*;
declare_id!("8yBiqm4eZjDQACD5JnZrvoKB6nyE9xDh3yvMiPnWtTpL");
#[program]
pub mod multi_state_account_example {
use super::*;
pub fn create_many_faced_account_first_state(ctx: Context<CreateManyFacedAccount>, _account_bump:u8, first_hi1_to_add:u64, first_hi2_to_add:u32) -> ProgramResult {
let new_state = State::FirstState {