Keywords

See a detailed list of all keywords for the Clarity language.

Keyword reference

block-height

Output: uint

Returns the current block height of the Stacks blockchain as an uint

Example

(> block-height 1000) ;; returns true if the current block-height has passed 1000 blocks.(> block-height 1000) ;; returns true if the current block-height has passed 1000 blocks.

burn-block-height

Output: uint

Returns the current block height of the underlying burn blockchain as a uint

Example

(> burn-block-height 1000) ;; returns true if the current height of the underlying burn blockchain has passed 1000 blocks.(> burn-block-height 1000) ;; returns true if the current height of the underlying burn blockchain has passed 1000 blocks.

contract-caller

Output: principal

Returns the caller of the current contract context. If this contract is the first one called by a signed transaction, the caller will be equal to the signing principal. If contract-call? was used to invoke a function from a new contract, contract-caller changes to the calling contract's principal. If as-contract is used to change the tx-sender context, contract-caller also changes to the same contract principal.

Example

(print contract-caller) ;; Will print out a Stacks address of the transaction sender(print contract-caller) ;; Will print out a Stacks address of the transaction sender

false

Output: bool

Boolean false constant.

Example

(and true false) ;; Evaluates to false (or false true) ;; Evaluates to true(and true false) ;; Evaluates to false(or false true) ;; Evaluates to true

is-in-regtest

Output: bool

Returns whether or not the code is running in a regression test

Example

(print is-in-regtest) ;; Will print 'true' if the code is running in a regression test(print is-in-regtest) ;; Will print 'true' if the code is running in a regression test

none

Output: (optional ?)

Represents the none option indicating no value for a given optional (analogous to a null value).

Example

(define-public (only-if-positive (a int)) (if (> a 0) (some a) none)) (only-if-positive 4) ;; Returns (some 4) (only-if-positive (- 3)) ;; Returns none(define-public (only-if-positive (a int)) (if (> a 0) (some a) none))(only-if-positive 4) ;; Returns (some 4)(only-if-positive (- 3)) ;; Returns none

stx-liquid-supply

Output: uint

Returns the total number of micro-STX (uSTX) that are liquid in the system as of this block.

Example

(print stx-liquid-supply) ;; Will print out the total number of liquid uSTX(print stx-liquid-supply) ;; Will print out the total number of liquid uSTX

true

Output: bool

Boolean true constant.

Example

(and true false) ;; Evaluates to false (or false true) ;; Evaluates to true(and true false) ;; Evaluates to false(or false true) ;; Evaluates to true

tx-sender

Output: principal

Returns the original sender of the current transaction, or if as-contract was called to modify the sending context, it returns that contract principal.

Example

(print tx-sender) ;; Will print out a Stacks address of the transaction sender(print tx-sender) ;; Will print out a Stacks address of the transaction sender
Search docs
K
On this page
Previous
Types
Next
Functions
Powered by