_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. Destinations
Numscript

Destinations

As with sources, there are several options when it comes to deciding where should funds in a financial transaction come from. The send statement provides the following ways of defining destinations:

Single destination#

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

Allocation destinations#

Similar to portioned sources, destination can be defined as a sequence of fractions to split the monetary onto multiple accounts.

In any case, the summed total of fractions in a block needs to be equal to 1 and the remaining keyword can be used to reach that total:

Numscript
send [COIN 100] (
  source = @world
  destination = {
    90/100 to @users:001
    remaining to @fees
  }
)

Out of convenience, percentage notation is also available:

Numscript
send [COIN 100] (
  source = @world
  destination = {
    90% to @users:001
    remaining to @fees
  }
)

Kept destinations#

Instead of transferring all funds to new accounts, you can specify that some portion should be "kept" (remain in the source account):

Syntax:

Numscript
destination = kept

or

Numscript
destination = {
    fraction or percentage to destination_account1
    remaining kept
  }

Example:

Numscript
send [COIN 100] (
  source = @world
  destination = {
    50% to @users:001
    remaining kept
  }
)

This is useful when you only want to transfer a portion of the funds.

Ordered destinations with maximum caps#

Ordered destinations route funds to multiple destinations in sequence, with maximum caps for each destination:

Syntax:

Numscript
{
  destination = {
    max [value] to @destination_account1
    remaining to @destination_account2
  }
}
Numscript
send [COIN 100] (
  source = @world
  destination = {
    max [COIN 20] to @users:001
    max [COIN 50] to @users:002
    remaining to @users:003
  }
)

This sends up to the specified maximum to each destination in order, with any remaining amount going to the final destination.

Nested destinations#

Finally, as with sources, destination blocks can be nested:

Numscript
send [COIN 100] (
  source = @world
  destination = {
    80% to @users:001
    20% to {
      70% to @platform
      15% to @taxes
      remaining to @charity
    }
  }
)
SourcesRounding
On This Page
  • Single destination
  • Allocation destinations
  • Kept destinations
  • Ordered destinations with maximum caps
  • Nested destinations