plutus-use-cases-0.1.0.0: Collection of smart contracts to develop the plutus/wallet interface
Safe HaskellNone
LanguageHaskell2010

Plutus.Contracts.TokenAccount

Description

Plutus implementation of an account that can be unlocked with a token. Whoever owns the token can spend the outputs locked by the contract. (A suitable token can be created with the Currency contract, or with newAccount in this module)

Synopsis

Documentation

newtype Account Source #

Constructors

Account 

Instances

Instances details
Eq Account Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

Show Account Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

Generic Account Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

Associated Types

type Rep Account :: Type -> Type Source #

ToJSON Account Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

FromJSON Account Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

Pretty Account Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

Methods

pretty :: Account -> Doc ann Source #

prettyList :: [Account] -> Doc ann Source #

UnsafeFromData Account Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

FromData Account Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

ToData Account Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

Lift DefaultUni Account Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

Typeable DefaultUni Account Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

type Rep Account Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

type Rep Account = D1 ('MetaData "Account" "Plutus.Contracts.TokenAccount" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" 'True) (C1 ('MetaCons "Account" 'PrefixI 'True) (S1 ('MetaSel ('Just "accountOwner") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AssetClass)))

Contract functionality

pay :: AsTokenAccountError e => Account -> Value -> Contract w s e CardanoTx Source #

Pay some money to the given token account

redeem Source #

Arguments

:: AsTokenAccountError e 
=> PaymentPubKeyHash

Where the token should go after the transaction

-> Account

The token account

-> Contract w s e CardanoTx 

Empty the account by spending all outputs belonging to the Account.

newAccount Source #

Arguments

:: forall w s e. AsTokenAccountError e 
=> TokenName

Name of the token

-> PaymentPubKeyHash

Public key of the token's initial owner

-> Contract w s e Account 

Create a new token and return its Account information.

balance :: AsTokenAccountError e => Account -> Contract w s e Value Source #

balance account returns the value of all unspent outputs that can be unlocked with accountToken account

payTx :: Value -> TxConstraints (RedeemerType TokenAccount) (DatumType TokenAccount) Source #

A transaction that pays the given value to the account

redeemTx :: forall w s e. AsTokenAccountError e => Account -> PaymentPubKeyHash -> Contract w s e (TxConstraints () (), ScriptLookups TokenAccount) Source #

Create a transaction that spends all outputs belonging to the Account.

Endpoints

tokenAccountContract :: forall w s e. (HasTokenAccountSchema s, AsTokenAccountError e) => Contract w s e () Source #

redeem, pay and newAccount with endpoints.

Etc.

data TokenAccountError Source #

Instances

Instances details
Eq TokenAccountError Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

Show TokenAccountError Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

Generic TokenAccountError Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

Associated Types

type Rep TokenAccountError :: Type -> Type Source #

ToJSON TokenAccountError Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

FromJSON TokenAccountError Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

AsContractError TokenAccountError Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

AsCurrencyError TokenAccountError Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

AsTokenAccountError TokenAccountError Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

type Rep TokenAccountError Source # 
Instance details

Defined in Plutus.Contracts.TokenAccount

type Rep TokenAccountError = D1 ('MetaData "TokenAccountError" "Plutus.Contracts.TokenAccount" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" 'False) (C1 ('MetaCons "TAContractError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContractError)) :+: C1 ('MetaCons "TACurrencyError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CurrencyError)))