Preview. Stack v4.0 has not been released, and what is documented here can still change before it does. The current release is v3.2.Go to v3.2
Numscript

Send

Move an amount of an asset between sources and destinations with the Numscript send statement.

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 follows:

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

Square brackets describe the asset being moved using 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 those in the 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.