Acme Bank v1.0.0-dev Bank.Ledger

A simple implementation of double-entry accounting system.

Basically, we store every Bank.Ledger.Entry twice - once for each account affected. Thus, if Alice transfers $10.00 to Bob we’ll have two entries:

  • debit Alice’s account for $10.00
  • credit Bob’s account for $10.00

Bank.Ledger.Entry can be a credit or a debit. Depending on Bank.Ledger.Account’s type, a credit can result in the increase (or decrease) of that accounts’ balance. See balance/1.

Double-entry accounting system implementation is usually required for compliance with other financial institutions.

See Wikipedia entry for more information

Summary

Functions

Returns account’s balance as Money

Creates a wallet account for a given username

Functions

balance(account)

Returns account’s balance as Money.

We calculate balance over all account’s entry. Balance increases or decreases are based on Bank.Account’s type and Bank.Entry’s type according to this table:

          | Debit    | Credit
----------|----------|---------
Asset     | Increase | Decrease
Liability | Decrease | Increase
create_wallet!(username)

Creates a wallet account for a given username.

deposits_account()
entries(account)
write(entries)