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

Plutus.Contracts.Stablecoin

Synopsis

Documentation

newtype SC a Source #

An amount of stablecoins

Constructors

SC 

Fields

Instances

Instances details
Functor SC Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

fmap :: (a -> b) -> SC a -> SC b

Lift DefaultUni a => Lift DefaultUni (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

Eq a => Eq (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(==) :: SC a -> SC a -> Bool Source #

(/=) :: SC a -> SC a -> Bool Source #

Num a => Num (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(+) :: SC a -> SC a -> SC a Source #

(-) :: SC a -> SC a -> SC a Source #

(*) :: SC a -> SC a -> SC a Source #

negate :: SC a -> SC a Source #

abs :: SC a -> SC a Source #

signum :: SC a -> SC a Source #

fromInteger :: Integer -> SC a Source #

Show a => Show (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

showsPrec :: Int -> SC a -> ShowS Source #

show :: SC a -> String Source #

showList :: [SC a] -> ShowS Source #

Generic (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Associated Types

type Rep (SC a) :: Type -> Type Source #

Methods

from :: SC a -> Rep (SC a) x Source #

to :: Rep (SC a) x -> SC a Source #

FromJSON a => FromJSON (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

parseJSON :: Value -> Parser (SC a)

parseJSONList :: Value -> Parser [SC a]

ToJSON a => ToJSON (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toJSON :: SC a -> Value

toEncoding :: SC a -> Encoding

toJSONList :: [SC a] -> Value

toEncodingList :: [SC a] -> Encoding

ToData a => ToData (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toBuiltinData :: SC a -> BuiltinData

FromData a => FromData (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

fromBuiltinData :: BuiltinData -> Maybe (SC a)

AdditiveGroup a => AdditiveGroup (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(-) :: SC a -> SC a -> SC a

AdditiveMonoid a => AdditiveMonoid (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

zero :: SC a

AdditiveSemigroup a => AdditiveSemigroup (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(+) :: SC a -> SC a -> SC a

Eq a => Eq (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(==) :: SC a -> SC a -> Bool

MultiplicativeSemigroup a => MultiplicativeSemigroup (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(*) :: SC a -> SC a -> SC a

Ord a => Ord (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

compare :: SC a -> SC a -> Ordering

(<) :: SC a -> SC a -> Bool

(<=) :: SC a -> SC a -> Bool

(>) :: SC a -> SC a -> Bool

(>=) :: SC a -> SC a -> Bool

max :: SC a -> SC a -> SC a

min :: SC a -> SC a -> SC a

UnsafeFromData a => UnsafeFromData (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

unsafeFromBuiltinData :: BuiltinData -> SC a

Typeable DefaultUni SC Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

type Rep (SC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

type Rep (SC a) = D1 ('MetaData "SC" "Plutus.Contracts.Stablecoin" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'True) (C1 ('MetaCons "SC" 'PrefixI 'True) (S1 ('MetaSel ('Just "unSC") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

newtype RC a Source #

An amount of reservecoins

Constructors

RC 

Fields

Instances

Instances details
Functor RC Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

fmap :: (a -> b) -> RC a -> RC b

Lift DefaultUni a => Lift DefaultUni (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

Eq a => Eq (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(==) :: RC a -> RC a -> Bool Source #

(/=) :: RC a -> RC a -> Bool Source #

Num a => Num (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(+) :: RC a -> RC a -> RC a Source #

(-) :: RC a -> RC a -> RC a Source #

(*) :: RC a -> RC a -> RC a Source #

negate :: RC a -> RC a Source #

abs :: RC a -> RC a Source #

signum :: RC a -> RC a Source #

fromInteger :: Integer -> RC a Source #

Show a => Show (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

showsPrec :: Int -> RC a -> ShowS Source #

show :: RC a -> String Source #

showList :: [RC a] -> ShowS Source #

Generic (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Associated Types

type Rep (RC a) :: Type -> Type Source #

Methods

from :: RC a -> Rep (RC a) x Source #

to :: Rep (RC a) x -> RC a Source #

FromJSON a => FromJSON (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

parseJSON :: Value -> Parser (RC a)

parseJSONList :: Value -> Parser [RC a]

ToJSON a => ToJSON (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toJSON :: RC a -> Value

toEncoding :: RC a -> Encoding

toJSONList :: [RC a] -> Value

toEncodingList :: [RC a] -> Encoding

ToData a => ToData (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toBuiltinData :: RC a -> BuiltinData

FromData a => FromData (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

fromBuiltinData :: BuiltinData -> Maybe (RC a)

AdditiveGroup a => AdditiveGroup (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(-) :: RC a -> RC a -> RC a

AdditiveMonoid a => AdditiveMonoid (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

zero :: RC a

AdditiveSemigroup a => AdditiveSemigroup (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(+) :: RC a -> RC a -> RC a

Eq a => Eq (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(==) :: RC a -> RC a -> Bool

MultiplicativeSemigroup a => MultiplicativeSemigroup (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(*) :: RC a -> RC a -> RC a

Ord a => Ord (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

compare :: RC a -> RC a -> Ordering

(<) :: RC a -> RC a -> Bool

(<=) :: RC a -> RC a -> Bool

(>) :: RC a -> RC a -> Bool

(>=) :: RC a -> RC a -> Bool

max :: RC a -> RC a -> RC a

min :: RC a -> RC a -> RC a

UnsafeFromData a => UnsafeFromData (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

unsafeFromBuiltinData :: BuiltinData -> RC a

Typeable DefaultUni RC Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

type Rep (RC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

type Rep (RC a) = D1 ('MetaData "RC" "Plutus.Contracts.Stablecoin" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'True) (C1 ('MetaCons "RC" 'PrefixI 'True) (S1 ('MetaSel ('Just "unRC") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

newtype BC a Source #

An amount of base currency coins (eg. Ada or some native currency)

Constructors

BC 

Fields

Instances

Instances details
Functor BC Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

fmap :: (a -> b) -> BC a -> BC b

Lift DefaultUni a => Lift DefaultUni (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

Eq a => Eq (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(==) :: BC a -> BC a -> Bool Source #

(/=) :: BC a -> BC a -> Bool Source #

Num a => Num (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(+) :: BC a -> BC a -> BC a Source #

(-) :: BC a -> BC a -> BC a Source #

(*) :: BC a -> BC a -> BC a Source #

negate :: BC a -> BC a Source #

abs :: BC a -> BC a Source #

signum :: BC a -> BC a Source #

fromInteger :: Integer -> BC a Source #

Show a => Show (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

showsPrec :: Int -> BC a -> ShowS Source #

show :: BC a -> String Source #

showList :: [BC a] -> ShowS Source #

Generic (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Associated Types

type Rep (BC a) :: Type -> Type Source #

Methods

from :: BC a -> Rep (BC a) x Source #

to :: Rep (BC a) x -> BC a Source #

FromJSON a => FromJSON (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

parseJSON :: Value -> Parser (BC a)

parseJSONList :: Value -> Parser [BC a]

ToJSON a => ToJSON (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toJSON :: BC a -> Value

toEncoding :: BC a -> Encoding

toJSONList :: [BC a] -> Value

toEncodingList :: [BC a] -> Encoding

ToData a => ToData (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toBuiltinData :: BC a -> BuiltinData

FromData a => FromData (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

fromBuiltinData :: BuiltinData -> Maybe (BC a)

AdditiveGroup a => AdditiveGroup (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(-) :: BC a -> BC a -> BC a

AdditiveMonoid a => AdditiveMonoid (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

zero :: BC a

AdditiveSemigroup a => AdditiveSemigroup (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(+) :: BC a -> BC a -> BC a

Eq a => Eq (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(==) :: BC a -> BC a -> Bool

MultiplicativeSemigroup a => MultiplicativeSemigroup (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(*) :: BC a -> BC a -> BC a

Ord a => Ord (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

compare :: BC a -> BC a -> Ordering

(<) :: BC a -> BC a -> Bool

(<=) :: BC a -> BC a -> Bool

(>) :: BC a -> BC a -> Bool

(>=) :: BC a -> BC a -> Bool

max :: BC a -> BC a -> BC a

min :: BC a -> BC a -> BC a

UnsafeFromData a => UnsafeFromData (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

unsafeFromBuiltinData :: BuiltinData -> BC a

Typeable DefaultUni BC Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

type Rep (BC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

type Rep (BC a) = D1 ('MetaData "BC" "Plutus.Contracts.Stablecoin" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'True) (C1 ('MetaCons "BC" 'PrefixI 'True) (S1 ('MetaSel ('Just "unBC") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

newtype PC a Source #

An amount of peg currency (eg. USD)

Constructors

PC 

Fields

Instances

Instances details
Functor PC Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

fmap :: (a -> b) -> PC a -> PC b

Lift DefaultUni a => Lift DefaultUni (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

Eq a => Eq (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(==) :: PC a -> PC a -> Bool Source #

(/=) :: PC a -> PC a -> Bool Source #

Num a => Num (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(+) :: PC a -> PC a -> PC a Source #

(-) :: PC a -> PC a -> PC a Source #

(*) :: PC a -> PC a -> PC a Source #

negate :: PC a -> PC a Source #

abs :: PC a -> PC a Source #

signum :: PC a -> PC a Source #

fromInteger :: Integer -> PC a Source #

Show a => Show (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

showsPrec :: Int -> PC a -> ShowS Source #

show :: PC a -> String Source #

showList :: [PC a] -> ShowS Source #

Generic (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Associated Types

type Rep (PC a) :: Type -> Type Source #

Methods

from :: PC a -> Rep (PC a) x Source #

to :: Rep (PC a) x -> PC a Source #

FromJSON a => FromJSON (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

parseJSON :: Value -> Parser (PC a)

parseJSONList :: Value -> Parser [PC a]

ToJSON a => ToJSON (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toJSON :: PC a -> Value

toEncoding :: PC a -> Encoding

toJSONList :: [PC a] -> Value

toEncodingList :: [PC a] -> Encoding

ToData a => ToData (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toBuiltinData :: PC a -> BuiltinData

FromData a => FromData (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

fromBuiltinData :: BuiltinData -> Maybe (PC a)

AdditiveGroup a => AdditiveGroup (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(-) :: PC a -> PC a -> PC a

AdditiveMonoid a => AdditiveMonoid (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

zero :: PC a

AdditiveSemigroup a => AdditiveSemigroup (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(+) :: PC a -> PC a -> PC a

Eq a => Eq (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(==) :: PC a -> PC a -> Bool

MultiplicativeSemigroup a => MultiplicativeSemigroup (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

(*) :: PC a -> PC a -> PC a

Ord a => Ord (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

compare :: PC a -> PC a -> Ordering

(<) :: PC a -> PC a -> Bool

(<=) :: PC a -> PC a -> Bool

(>) :: PC a -> PC a -> Bool

(>=) :: PC a -> PC a -> Bool

max :: PC a -> PC a -> PC a

min :: PC a -> PC a -> PC a

UnsafeFromData a => UnsafeFromData (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

unsafeFromBuiltinData :: BuiltinData -> PC a

Typeable DefaultUni PC Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

type Rep (PC a) Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

type Rep (PC a) = D1 ('MetaData "PC" "Plutus.Contracts.Stablecoin" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'True) (C1 ('MetaCons "PC" 'PrefixI 'True) (S1 ('MetaSel ('Just "unPC") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

data BankState Source #

The bank's state

Constructors

BankState 

Fields

Instances

Instances details
Eq BankState Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Show BankState Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Generic BankState Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Associated Types

type Rep BankState :: Type -> Type Source #

FromJSON BankState Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

parseJSON :: Value -> Parser BankState

parseJSONList :: Value -> Parser [BankState]

ToJSON BankState Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toJSON :: BankState -> Value

toEncoding :: BankState -> Encoding

toJSONList :: [BankState] -> Value

toEncodingList :: [BankState] -> Encoding

ToData BankState Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toBuiltinData :: BankState -> BuiltinData

FromData BankState Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

fromBuiltinData :: BuiltinData -> Maybe BankState

UnsafeFromData BankState Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

unsafeFromBuiltinData :: BuiltinData -> BankState

Lift DefaultUni BankState Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

Typeable DefaultUni BankState Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

type Rep BankState Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

type Rep BankState = D1 ('MetaData "BankState" "Plutus.Contracts.Stablecoin" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'False) (C1 ('MetaCons "BankState" 'PrefixI 'True) ((S1 ('MetaSel ('Just "bsReserves") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (BC Integer)) :*: S1 ('MetaSel ('Just "bsStablecoins") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SC Integer))) :*: (S1 ('MetaSel ('Just "bsReservecoins") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RC Integer)) :*: S1 ('MetaSel ('Just "bsMintingPolicyScript") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MintingPolicyHash))))

data Stablecoin Source #

Stablecoin parameters.

Constructors

Stablecoin 

Fields

  • scOracle :: PaymentPubKey

    Public key of the oracle that provides exchange rates

  • scFee :: Rational

    Fee charged by bank for transactions. Calculated as a fraction of the total transaction volume in base currency.

  • scMinReserveRatio :: Rational

    The minimum ratio of reserves to liabilities

  • scMaxReserveRatio :: Rational

    The maximum ratio of reserves to liabilities

  • scReservecoinDefaultPrice :: BC Integer

    The price of a single reservecoin if no reservecoins have been issued

  • scBaseCurrency :: AssetClass

    The asset class of the base currency. Value of this currency will be locked by the stablecoin state machine instance

  • scStablecoinTokenName :: TokenName

    TokenName of the stablecoin

  • scReservecoinTokenName :: TokenName

    TokenName of the reservecoin

Instances

Instances details
Eq Stablecoin Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Show Stablecoin Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Generic Stablecoin Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Associated Types

type Rep Stablecoin :: Type -> Type Source #

FromJSON Stablecoin Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

parseJSON :: Value -> Parser Stablecoin

parseJSONList :: Value -> Parser [Stablecoin]

ToJSON Stablecoin Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toJSON :: Stablecoin -> Value

toEncoding :: Stablecoin -> Encoding

toJSONList :: [Stablecoin] -> Value

toEncodingList :: [Stablecoin] -> Encoding

ToData Stablecoin Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toBuiltinData :: Stablecoin -> BuiltinData

FromData Stablecoin Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

fromBuiltinData :: BuiltinData -> Maybe Stablecoin

UnsafeFromData Stablecoin Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

unsafeFromBuiltinData :: BuiltinData -> Stablecoin

Lift DefaultUni Stablecoin Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

Typeable DefaultUni Stablecoin Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

type Rep Stablecoin Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

type Rep Stablecoin = D1 ('MetaData "Stablecoin" "Plutus.Contracts.Stablecoin" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'False) (C1 ('MetaCons "Stablecoin" 'PrefixI 'True) (((S1 ('MetaSel ('Just "scOracle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PaymentPubKey) :*: S1 ('MetaSel ('Just "scFee") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Rational)) :*: (S1 ('MetaSel ('Just "scMinReserveRatio") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Rational) :*: S1 ('MetaSel ('Just "scMaxReserveRatio") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Rational))) :*: ((S1 ('MetaSel ('Just "scReservecoinDefaultPrice") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (BC Integer)) :*: S1 ('MetaSel ('Just "scBaseCurrency") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AssetClass)) :*: (S1 ('MetaSel ('Just "scStablecoinTokenName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TokenName) :*: S1 ('MetaSel ('Just "scReservecoinTokenName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TokenName)))))

data Input Source #

Input to the stablecoin state machine

Constructors

Input 

Fields

Instances

Instances details
Eq Input Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

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

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

Show Input Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Generic Input Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Associated Types

type Rep Input :: Type -> Type Source #

Methods

from :: Input -> Rep Input x Source #

to :: Rep Input x -> Input Source #

FromJSON Input Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

parseJSON :: Value -> Parser Input

parseJSONList :: Value -> Parser [Input]

ToJSON Input Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toJSON :: Input -> Value

toEncoding :: Input -> Encoding

toJSONList :: [Input] -> Value

toEncodingList :: [Input] -> Encoding

ToData Input Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toBuiltinData :: Input -> BuiltinData

FromData Input Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

fromBuiltinData :: BuiltinData -> Maybe Input

UnsafeFromData Input Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

unsafeFromBuiltinData :: BuiltinData -> Input

type Rep Input Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

type Rep Input = D1 ('MetaData "Input" "Plutus.Contracts.Stablecoin" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'False) (C1 ('MetaCons "Input" 'PrefixI 'True) (S1 ('MetaSel ('Just "inpSCAction") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SCAction) :*: S1 ('MetaSel ('Just "inpConversionRate") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SignedMessage (Observation ConversionRate)))))

data SCAction Source #

Action that can be performed on the stablecoin contract.

Constructors

MintStablecoin (SC Integer)

Create a number stablecoins, depositing the matching amount of base currency

MintReserveCoin (RC Integer)

Create a number of reservecoins, depositing the matching amount of base currency

Instances

Instances details
Eq SCAction Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Show SCAction Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Generic SCAction Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Associated Types

type Rep SCAction :: Type -> Type Source #

FromJSON SCAction Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

parseJSON :: Value -> Parser SCAction

parseJSONList :: Value -> Parser [SCAction]

ToJSON SCAction Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toJSON :: SCAction -> Value

toEncoding :: SCAction -> Encoding

toJSONList :: [SCAction] -> Value

toEncodingList :: [SCAction] -> Encoding

ToData SCAction Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toBuiltinData :: SCAction -> BuiltinData

FromData SCAction Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

fromBuiltinData :: BuiltinData -> Maybe SCAction

UnsafeFromData SCAction Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

unsafeFromBuiltinData :: BuiltinData -> SCAction

type Rep SCAction Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

type Rep SCAction = D1 ('MetaData "SCAction" "Plutus.Contracts.Stablecoin" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'False) (C1 ('MetaCons "MintStablecoin" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SC Integer))) :+: C1 ('MetaCons "MintReserveCoin" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RC Integer))))

type ConversionRate = Rational Source #

Conversion rate from peg currency (eg. USD) to base currency (eg. Ada)

State machine client

typedValidator :: Stablecoin -> TypedValidator (StateMachine BankState Input) Source #

machineClient :: TypedValidator (StateMachine BankState Input) -> Stablecoin -> StateMachineClient BankState Input Source #

step :: forall i o. Stablecoin -> BankState -> Input -> Maybe (TxConstraints i o, BankState) Source #

Contract using the state machine

contract :: Promise () StablecoinSchema StablecoinError () Source #

A Contract that initialises the state machine and then accepts Input transitions.

data StablecoinError Source #

Instances

Instances details
Show StablecoinError Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Generic StablecoinError Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Associated Types

type Rep StablecoinError :: Type -> Type Source #

FromJSON StablecoinError Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

parseJSON :: Value -> Parser StablecoinError

parseJSONList :: Value -> Parser [StablecoinError]

ToJSON StablecoinError Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

toJSON :: StablecoinError -> Value

toEncoding :: StablecoinError -> Encoding

toJSONList :: [StablecoinError] -> Value

toEncodingList :: [StablecoinError] -> Encoding

AsContractError StablecoinError Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

_ContractError :: Prism' StablecoinError ContractError

_WalletContractError :: Prism' StablecoinError WalletAPIError

_ChainIndexContractError :: Prism' StablecoinError (Text, ChainIndexResponse)

_ConstraintResolutionContractError :: Prism' StablecoinError MkTxError

_ToCardanoConvertContractError :: Prism' StablecoinError ToCardanoError

_ResumableContractError :: Prism' StablecoinError MatchingError

_CCheckpointContractError :: Prism' StablecoinError CheckpointError

_EndpointDecodeContractError :: Prism' StablecoinError (EndpointDescription, EndpointValue Value, Text)

_OtherContractError :: Prism' StablecoinError Text

AsSMContractError StablecoinError Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

Methods

_SMContractError :: Prism' StablecoinError SMContractError

_ChooserError :: Prism' StablecoinError Text

_UnableToExtractTransition :: Prism' StablecoinError ()

_SMCContractError :: Prism' StablecoinError ContractError

type Rep StablecoinError Source # 
Instance details

Defined in Plutus.Contracts.Stablecoin

type Rep StablecoinError = D1 ('MetaData "StablecoinError" "Plutus.Contracts.Stablecoin" "plutus-use-cases-1.2.0.0-BuYOLXrynPcLosE012cowc" 'False) (C1 ('MetaCons "InitialiseEPError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContractError)) :+: (C1 ('MetaCons "StateMachineError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SMContractError)) :+: C1 ('MetaCons "RunStepError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContractError))))

type StablecoinSchema = Endpoint "run step" Input .\/ Endpoint "initialise" Stablecoin Source #

Etc.

stableCoins :: Stablecoin -> SC Integer -> Value Source #

A Value with the given number of stablecoins

reserveCoins :: Stablecoin -> RC Integer -> Value Source #

A Value with the given number of reservecoins