Safe Haskell | None |
---|---|
Language | Haskell2010 |
Implements a custom currency with a minting policy that allows the minting of a fixed amount of units.
Synopsis
- data OneShotCurrency = OneShotCurrency {
- curRefTransactionOutput :: (TxId, Integer)
- curAmounts :: Map TokenName Integer
- type CurrencySchema = Endpoint "Create native token" SimpleMPS
- newtype CurrencyError = CurContractError ContractError
- class AsCurrencyError r where
- _CurrencyError :: Prism' r CurrencyError
- _CurContractError :: Prism' r ContractError
- curPolicy :: OneShotCurrency -> MintingPolicy
- mintContract :: forall w s e. AsCurrencyError e => CardanoAddress -> [(TokenName, Integer)] -> Contract w s e OneShotCurrency
- mintedValue :: OneShotCurrency -> Value
- currencySymbol :: OneShotCurrency -> CurrencySymbol
- currencyPolicyId :: OneShotCurrency -> PolicyId
- data SimpleMPS = SimpleMPS {}
- mintCurrency :: Promise (Maybe (Last OneShotCurrency)) CurrencySchema CurrencyError OneShotCurrency
Documentation
data OneShotCurrency Source #
A currency that can be created exactly once
OneShotCurrency | |
|
Instances
type CurrencySchema = Endpoint "Create native token" SimpleMPS Source #
newtype CurrencyError Source #
CurContractError ContractError |
Instances
class AsCurrencyError r where Source #
_CurrencyError :: Prism' r CurrencyError Source #
_CurContractError :: Prism' r ContractError Source #
Instances
AsCurrencyError CurrencyError Source # | |
Defined in Plutus.Contracts.Currency _CurrencyError :: Prism' CurrencyError CurrencyError Source # _CurContractError :: Prism' CurrencyError ContractError Source # | |
AsCurrencyError TokenAccountError Source # | |
Defined in Plutus.Contracts.TokenAccount _CurrencyError :: Prism' TokenAccountError CurrencyError Source # _CurContractError :: Prism' TokenAccountError ContractError Source # |
curPolicy :: OneShotCurrency -> MintingPolicy Source #
Actions etc
mintContract :: forall w s e. AsCurrencyError e => CardanoAddress -> [(TokenName, Integer)] -> Contract w s e OneShotCurrency Source #
mint [(n1, c1), ..., (n_k, c_k)]
creates a new currency with
k
token names, minting c_i
units of each token n_i
.
If k == 0
then no value is minted. A one-shot minting policy
script is used to ensure that no more units of the currency can
be minted afterwards.
mintedValue :: OneShotCurrency -> Value Source #
The Value
minted by the OneShotCurrency
contract
currencySymbol :: OneShotCurrency -> CurrencySymbol Source #
currencyPolicyId :: OneShotCurrency -> PolicyId Source #
Simple minting policy currency
Minting policy for a currency that has a fixed amount of tokens issued in one transaction
Instances
Eq SimpleMPS Source # | |
Show SimpleMPS Source # | |
Generic SimpleMPS Source # | |
FromJSON SimpleMPS Source # | |
Defined in Plutus.Contracts.Currency parseJSON :: Value -> Parser SimpleMPS parseJSONList :: Value -> Parser [SimpleMPS] | |
ToJSON SimpleMPS Source # | |
Defined in Plutus.Contracts.Currency toEncoding :: SimpleMPS -> Encoding toJSONList :: [SimpleMPS] -> Value toEncodingList :: [SimpleMPS] -> Encoding | |
type Rep SimpleMPS Source # | |
Defined in Plutus.Contracts.Currency type Rep SimpleMPS = D1 ('MetaData "SimpleMPS" "Plutus.Contracts.Currency" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'False) (C1 ('MetaCons "SimpleMPS" 'PrefixI 'True) (S1 ('MetaSel ('Just "tokenName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TokenName) :*: S1 ('MetaSel ('Just "amount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer))) |
mintCurrency :: Promise (Maybe (Last OneShotCurrency)) CurrencySchema CurrencyError OneShotCurrency Source #
Use mintContract
to create the currency specified by a SimpleMPS