plutus-script-utils-1.2.0.0: Helper/utility functions for writing Plutus scripts.
Safe HaskellNone
LanguageHaskell2010

Plutus.Script.Utils.Ada

Description

Functions for working with Ada in Template Haskell.

Synopsis

Documentation

newtype Ada Source #

ADA, the special currency on the Cardano blockchain. The unit of Ada is Lovelace, and 1M Lovelace is one Ada. See note [Currencies] in TH.

Constructors

Lovelace 

Fields

Instances

Instances details
Enum Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Eq Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

(==) :: Ada -> Ada -> Bool Source #

(/=) :: Ada -> Ada -> Bool Source #

Integral Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

quot :: Ada -> Ada -> Ada Source #

rem :: Ada -> Ada -> Ada Source #

div :: Ada -> Ada -> Ada Source #

mod :: Ada -> Ada -> Ada Source #

quotRem :: Ada -> Ada -> (Ada, Ada) Source #

divMod :: Ada -> Ada -> (Ada, Ada) Source #

toInteger :: Ada -> Integer Source #

Num Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Ord Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

compare :: Ada -> Ada -> Ordering Source #

(<) :: Ada -> Ada -> Bool Source #

(<=) :: Ada -> Ada -> Bool Source #

(>) :: Ada -> Ada -> Bool Source #

(>=) :: Ada -> Ada -> Bool Source #

max :: Ada -> Ada -> Ada Source #

min :: Ada -> Ada -> Ada Source #

Real Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Show Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Generic Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Associated Types

type Rep Ada :: Type -> Type Source #

Methods

from :: Ada -> Rep Ada x Source #

to :: Rep Ada x -> Ada Source #

Semigroup Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

(<>) :: Ada -> Ada -> Ada Source #

sconcat :: NonEmpty Ada -> Ada Source #

stimes :: Integral b => b -> Ada -> Ada Source #

Monoid Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Serialise Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

encode :: Ada -> Encoding

decode :: Decoder s Ada

encodeList :: [Ada] -> Encoding

decodeList :: Decoder s [Ada]

FromJSON Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

parseJSON :: Value -> Parser Ada

parseJSONList :: Value -> Parser [Ada]

ToJSON Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

toJSON :: Ada -> Value

toEncoding :: Ada -> Encoding

toJSONList :: [Ada] -> Value

toEncodingList :: [Ada] -> Encoding

AdditiveGroup Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

(-) :: Ada -> Ada -> Ada

AdditiveMonoid Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

zero :: Ada

AdditiveSemigroup Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

(+) :: Ada -> Ada -> Ada

Eq Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

(==) :: Ada -> Ada -> Bool

FromData Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

fromBuiltinData :: BuiltinData -> Maybe Ada

Monoid Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

mempty :: Ada

Ord Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

compare :: Ada -> Ada -> Ordering

(<) :: Ada -> Ada -> Bool

(<=) :: Ada -> Ada -> Bool

(>) :: Ada -> Ada -> Bool

(>=) :: Ada -> Ada -> Bool

max :: Ada -> Ada -> Ada

min :: Ada -> Ada -> Ada

Pretty Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

pretty :: Ada -> Doc ann

prettyList :: [Ada] -> Doc ann

Semigroup Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

(<>) :: Ada -> Ada -> Ada

ToData Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

toBuiltinData :: Ada -> BuiltinData

UnsafeFromData Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

unsafeFromBuiltinData :: BuiltinData -> Ada

MultiplicativeMonoid Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

one :: Ada

MultiplicativeSemigroup Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

(*) :: Ada -> Ada -> Ada

Lift DefaultUni Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

lift :: Ada -> RTCompile DefaultUni fun (Term TyName Name DefaultUni fun ())

Typeable DefaultUni Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

Methods

typeRep :: Proxy Ada -> RTCompile DefaultUni fun (Type TyName DefaultUni ())

type Rep Ada Source # 
Instance details

Defined in Plutus.Script.Utils.Ada

type Rep Ada = D1 ('MetaData "Ada" "Plutus.Script.Utils.Ada" "plutus-script-utils-1.2.0.0-5TpLCy32WGLK5IaOxcwe9j" 'True) (C1 ('MetaCons "Lovelace" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLovelace") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))

getAda :: Ada -> Micro Source #

Get the amount of Ada (the unit of the currency Ada) in this Ada value.

adaToken :: TokenName Source #

The TokenName of the Ada currency.

Constructors

fromValue :: Value -> Ada Source #

Get the Ada in the given Value.

toValue :: Ada -> Value Source #

Create a Value containing only the given Ada.

lovelaceOf :: Integer -> Ada Source #

Create Ada representing the given quantity of Lovelace (the unit of the currency Ada).

adaOf :: Micro -> Ada Source #

Create Ada representing the given quantity of Ada (1M Lovelace).

lovelaceValueOf :: Integer -> Value Source #

A Value with the given amount of Lovelace (the currency unit).

lovelaceValueOf == toValue . lovelaceOf

adaValueOf :: Micro -> Value Source #

A Value with the given amount of Ada (the currency unit).

adaValueOf == toValue . adaOf

Num operations

divide :: Ada -> Ada -> Ada Source #

Divide one Ada value by another.

Etc.

isZero :: Ada -> Bool Source #

Check whether an Ada value is zero.