_Docs/
Get StartedModulesPlatformDeployCookbookChangelogReference
_Stack
_Modules
  • Ledger
  • Numscript
    • Program Structure
    • Selecting an Interpreter
    • Unambiguous Monetary Notation
    • CLI
    • Numscript specs format
    • Reference
      • Send
      • Sources
      • Destinations
      • Rounding
      • Save
      • Overdraft
      • Variables
      • Metadata
      • oneofexp
      • Account Interpolationexp
      • get_assetexp
      • get_amountexp
      • Mid-script Function Callsexp
      • Asset Colorsexp
  • Connectivity
  • WalletsEE
  • FlowsEE
  • ReconciliationEE
  1. Modules
  2. Numscript
  3. Reference
  4. Send
Numscript

Send

In Numscript, a posting models the movement of an amount of an asset from one account to another. Postings are wrapped in a transaction to ensure that they are applied atomically.

Defining a posting#

A posting is defined as followed:

Numscript
send [COIN 100] (
  source = @world
  destination = @users:001
)

Square brackets describe the asset being moved using the Formance's Unambiguous Monetary Notation (UMN). It is composed of the asset type optionally followed by a scaling value, and the amount. In this case, the asset type is COIN with no scaling value, and the amount is 100.

Postings with balance#

You can omit the amount of an asset in a posting and replace it with a *. This is used when you want to move all of the assets of the accounts in the source block to the ones destination block.

Numscript
send [USD/2 *] (
  source = @order:1234
  destination = {
    10% to @platform:fees
    remaining to @merchant:5678
  }
)

Here, we are moving all of the USD/2 asset from the @order:1234 account. 10% of the @order:1234 balance is moved to the @platform:fees account, and the remaining 90% is moved to the @merchant:5678 account.

ReferenceSources
On This Page
  • Defining a posting
  • Postings with balance