# Directives
Every Ride script should start with directives for the compiler. The directives define the script format and available built-in functions, structures, and variables.
Directive format is as follows:
{-# DIRECTIVE_NAME VALUE #-}
# Directives List
Directive name | Description | Possible values |
---|---|---|
STDLIB_VERSION | Version of the Standard Library | 8 : enabled by feature #22 “Light Node”7 : enabled by feature #19 “Block Reward Distribution”6 : enabled by feature #17 “Ride V6, MetaMask support”5 : enabled by feature #16 “Ride V5, dApp-to-dApp invocations”4 : enabled by feature #15 “Ride V4, VRF, Protobuf, Failed transactions”3 2 1 |
CONTENT_TYPE | Script content type | DAPP : the script is a set of definitions and contains functions that can be invoked from another account.EXPRESSION : the script is a boolean expression expression used for transaction verification |
SCRIPT_TYPE | Script usage | ACCOUNT : the script is assigned to accountASSET : the script is assigned to assetLIBRARY : the script can be imported into other scripts as a library |
IMPORT | Libraries to import | Names of the libraries saved in Waves IDE |
# Directives Examples
For a dApp script:
{-# STDLIB_VERSION 8 #-}
{-# CONTENT_TYPE DAPP #-}
{-# SCRIPT_TYPE ACCOUNT #-}
For an account script:
{-# STDLIB_VERSION 8 #-}
{-# CONTENT_TYPE EXPRESSION #-}
{-# SCRIPT_TYPE ACCOUNT #-}
For an asset script:
{-# STDLIB_VERSION 8 #-}
{-# CONTENT_TYPE EXPRESSION #-}
{-# SCRIPT_TYPE ASSET #-}
For a library script:
{-# STDLIB_VERSION 8 #-}
{-# CONTENT_TYPE LIBRARY #-}
{-# SCRIPT_TYPE ACCOUNT #-}
Not all the combinations of directives are correct. The example below will not work, because DAPP
content type is allowed only for accounts:
# Wrong example, will not work
{-# STDLIB_VERSION 8 #-}
{-# CONTENT_TYPE DAPP #-}
{-# SCRIPT_TYPE ASSET #-}