🚧Constants

It’s useful to define constants in your interface for values that will be used in several functions, or values that other modules should be able to refer to.

Our faucet contract has a specific range of values that it will allow the per-request and per-account limits to be set to. It’s useful to capture these values in variables that our tests, module code, and other modules on NuChain can refer to. To expose a constant value, use (defconst).

// pact

(defconst FAUCET_ACCOUNT "nucredit-faucet-faucet   @doc "Account name of the faucet account that holds and disburses   funds.")(defconst DEFAULT_REQUEST_LIMIT 20.0   @doc "Users can at minimum ask for up to 20 NCH per request.")(defconst DEFAULT_ACCOUNT_LIMIT 100.0   @doc "Users can at minimum ask for up to 100 NCH per account.")

Last updated