Skip to content

stdlib/bankingView source ↗

banking

16 items · generated by scribe fromstdlib/banking.fd· synced 2026-11-15

stdlib/banking16 items

Contents

Account_open

Open a new account with an initial balance. NOT @conserve because it calls Money_new (minting).

pub fn Account_open(id: i64, initial_cents: i64) -> Account {

Parameters:

  • id: i64
  • initial_cents: i64

Returns: Account

Defined at line 37


Account_withdraw

Withdraw money from an account. Consumes the account, returns a new account with reduced balance AND the withdrawn cash. Conservation: old_balance = new_balance + withdrawn. NOT @conserve: it rebuilds balances from cents (Money_from_cents mints). A conserving version needs Money_split, blocked by the tuple layout bug (compiler/lower.fd names every 2-tuple layout __tuple_2).

pub fn Account_withdraw(acc: Account, withdraw_cents: i64) -> (Account, Money) {

Parameters:

  • acc: Account
  • withdraw_cents: i64

Returns: (Account, Money)

Defined at line 62


Account_transfer

Transfer money from one account to another. Consumes both accounts, returns both with updated balances. Conservation: A loses X, B gains X. Total unchanged. NOT @conserve: it rebuilds balances from cents (Money_from_cents mints). A conserving version needs Money_split, blocked by the tuple layout bug (compiler/lower.fd names every 2-tuple layout __tuple_2).

pub fn Account_transfer(from: Account, to: Account, amount_cents: i64) -> (Account, Account) {

Parameters:

  • from: Account
  • to: Account
  • amount_cents: i64

Returns: (Account, Account)

Defined at line 78


Account_balance_cents

Get the account balance in cents. Consumes the account. Not @conserve: it consumes the account, so its money leaves the system.

pub fn Account_balance_cents(acc: Account) -> i64 {

Parameters:

  • acc: Account

Returns: i64

Defined at line 109


Account_id

Get the account ID. Consumes the account. Not @conserve: it consumes the account, so its money leaves the system.

pub fn Account_id(acc: Account) -> i64 {

Parameters:

  • acc: Account

Returns: i64

Defined at line 115


Account_print

Print account info. NOT @conserve (has IO effect).

pub fn Account_print(acc: Account) -> void {

Parameters:

  • acc: Account

Returns: void

Defined at line 120


ACCOUNT_STATE_ACTIVE:

Account state constants.

pub const ACCOUNT_STATE_ACTIVE: i64 = 0; pub const ACCOUNT_STATE_FROZEN: i64 = 1; pub const ACCOUNT_STATE_CLOSED: i64 = 2;

Defined at line 154


AccountActive_open

Open a new active account with an initial balance.

pub fn AccountActive_open(id: i64, initial_cents: i64) -> AccountActive {

Parameters:

  • id: i64
  • initial_cents: i64

Returns: AccountActive

Defined at line 176


AccountActive_withdraw

Withdraw money from an active account. NOT @conserve: it rebuilds balances from cents (Money_from_cents mints). A conserving version needs Money_split, blocked by the tuple layout bug (compiler/lower.fd names every 2-tuple layout __tuple_2).

pub fn AccountActive_withdraw(acc: AccountActive, withdraw_cents: i64) -> (AccountActive, Money) {

Parameters:

  • acc: AccountActive
  • withdraw_cents: i64

Returns: (AccountActive, Money)

Defined at line 194


AccountActive_transfer

Transfer money between two active accounts. NOT @conserve: it rebuilds balances from cents (Money_from_cents mints). A conserving version needs Money_split, blocked by the tuple layout bug (compiler/lower.fd names every 2-tuple layout __tuple_2).

pub fn AccountActive_transfer(from: AccountActive, to: AccountActive, amount_cents: i64) -> (AccountActive, AccountActive) {

Parameters:

  • from: AccountActive
  • to: AccountActive
  • amount_cents: i64

Returns: (AccountActive, AccountActive)

Defined at line 207


AccountActive_balance_cents

Get balance of an active account. Not @conserve: it consumes the account, so its money leaves the system.

pub fn AccountActive_balance_cents(acc: AccountActive) -> i64 {

Parameters:

  • acc: AccountActive

Returns: i64

Defined at line 235


AccountActive_id

Get ID of an active account. Not @conserve: it consumes the account, so its money leaves the system.

pub fn AccountActive_id(acc: AccountActive) -> i64 {

Parameters:

  • acc: AccountActive

Returns: i64

Defined at line 241


AccountFrozen_balance_cents

Get balance of a frozen account (read-only). Not @conserve: it consumes the account, so its money leaves the system.

pub fn AccountFrozen_balance_cents(acc: AccountFrozen) -> i64 {

Parameters:

  • acc: AccountFrozen

Returns: i64

Defined at line 266


AccountFrozen_id

Get ID of a frozen account. Not @conserve: it consumes the account, so its money leaves the system.

pub fn AccountFrozen_id(acc: AccountFrozen) -> i64 {

Parameters:

  • acc: AccountFrozen

Returns: i64

Defined at line 272


AccountClosed_balance_cents

Get final balance of a closed account (for audit). Not @conserve: it consumes the account, so its money leaves the system.

pub fn AccountClosed_balance_cents(acc: AccountClosed) -> i64 {

Parameters:

  • acc: AccountClosed

Returns: i64

Defined at line 283


AccountClosed_id

Get ID of a closed account. Not @conserve: it consumes the account, so its money leaves the system.

pub fn AccountClosed_id(acc: AccountClosed) -> i64 {

Parameters:

  • acc: AccountClosed

Returns: i64

Defined at line 289


Generated by scribe, the Fides documentation generator