Skip to content

Instantly share code, notes, and snippets.

@mtso
Created June 22, 2022 13:37
Show Gist options
  • Save mtso/90b1c4158c45db8ef3c7c39be9358e51 to your computer and use it in GitHub Desktop.
Save mtso/90b1c4158c45db8ef3c7c39be9358e51 to your computer and use it in GitHub Desktop.
pub const Account = packed struct {
id: u128,
/// Opaque third-party identifier to link this account (many-to-one) to an external entity.
user_data: u128,
/// Reserved for accounting policy primitives.
reserved: [48]u8,
ledger: u32,
/// A chart of accounts code describing the type of account (e.g. clearing, settlement).
code: u16,
flags: AccountFlags,
debits_pending: u64,
debits_posted: u64,
credits_pending: u64,
credits_posted: u64,
timestamp: u64 = 0,
alignment: 128 bits (8 bytes)
16 * 8 = 128
| id | user_data |
| reserved0-15 | reserved16-31 |
| reserved 32–47 | ledger,code,flags, debits_pending |
| debits_posted, credits_pending | credits_posted,timestamp |
id: u128, 16 bytes
user_data: u128, 16 bytes
reserved: [48]u8, 16 bytes, 16 bytes, 16 bytes
ledger: u32,
/// A chart of accounts code describing the type of account (e.g. clearing, settlement).
code: u16,
flags: AccountFlags,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment