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

Plutus.Contracts.Uniswap.OffChain

Synopsis

Documentation

poolStateCoinFromUniswapCurrency Source #

Arguments

:: CurrencySymbol

The currency identifying the Uniswap instance.

-> Coin PoolState 

Gets the Coin used to identity liquidity pools.

liquidityCoin Source #

Arguments

:: CurrencySymbol

The currency identifying the Uniswap instance.

-> Coin A

One coin in the liquidity pair.

-> Coin B

The other coin in the liquidity pair.

-> Coin Liquidity 

Gets the liquidity token for a given liquidity pool.

data CreateParams Source #

Parameters for the create-endpoint, which creates a new liquidity pool.

Constructors

CreateParams 

Fields

Instances

Instances details
Show CreateParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

Generic CreateParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

Associated Types

type Rep CreateParams :: Type -> Type Source #

ToJSON CreateParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

FromJSON CreateParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

ToSchema CreateParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

type Rep CreateParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

type Rep CreateParams = D1 ('MetaData "CreateParams" "Plutus.Contracts.Uniswap.OffChain" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" 'False) (C1 ('MetaCons "CreateParams" 'PrefixI 'True) ((S1 ('MetaSel ('Just "cpCoinA") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Coin A)) :*: S1 ('MetaSel ('Just "cpCoinB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Coin B))) :*: (S1 ('MetaSel ('Just "cpAmountA") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Amount A)) :*: S1 ('MetaSel ('Just "cpAmountB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Amount B)))))

data SwapParams Source #

Parameters for the swap-endpoint, which allows swaps between the two different coins in a liquidity pool. One of the provided amounts must be positive, the other must be zero.

Constructors

SwapParams 

Fields

Instances

Instances details
Show SwapParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

Generic SwapParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

Associated Types

type Rep SwapParams :: Type -> Type Source #

ToJSON SwapParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

FromJSON SwapParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

ToSchema SwapParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

type Rep SwapParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

type Rep SwapParams = D1 ('MetaData "SwapParams" "Plutus.Contracts.Uniswap.OffChain" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" 'False) (C1 ('MetaCons "SwapParams" 'PrefixI 'True) ((S1 ('MetaSel ('Just "spCoinA") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Coin A)) :*: S1 ('MetaSel ('Just "spCoinB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Coin B))) :*: (S1 ('MetaSel ('Just "spAmountA") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Amount A)) :*: S1 ('MetaSel ('Just "spAmountB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Amount B)))))

data CloseParams Source #

Parameters for the close-endpoint, which closes a liquidity pool.

Constructors

CloseParams 

Fields

Instances

Instances details
Show CloseParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

Generic CloseParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

Associated Types

type Rep CloseParams :: Type -> Type Source #

ToJSON CloseParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

FromJSON CloseParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

ToSchema CloseParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

type Rep CloseParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

type Rep CloseParams = D1 ('MetaData "CloseParams" "Plutus.Contracts.Uniswap.OffChain" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" 'False) (C1 ('MetaCons "CloseParams" 'PrefixI 'True) (S1 ('MetaSel ('Just "clpCoinA") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Coin A)) :*: S1 ('MetaSel ('Just "clpCoinB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Coin B))))

data RemoveParams Source #

Parameters for the remove-endpoint, which removes some liquidity from a liquidity pool.

Constructors

RemoveParams 

Fields

Instances

Instances details
Show RemoveParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

Generic RemoveParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

Associated Types

type Rep RemoveParams :: Type -> Type Source #

ToJSON RemoveParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

FromJSON RemoveParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

ToSchema RemoveParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

type Rep RemoveParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

type Rep RemoveParams = D1 ('MetaData "RemoveParams" "Plutus.Contracts.Uniswap.OffChain" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" 'False) (C1 ('MetaCons "RemoveParams" 'PrefixI 'True) (S1 ('MetaSel ('Just "rpCoinA") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Coin A)) :*: (S1 ('MetaSel ('Just "rpCoinB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Coin B)) :*: S1 ('MetaSel ('Just "rpDiff") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Amount Liquidity)))))

data AddParams Source #

Parameters for the add-endpoint, which adds liquidity to a liquidity pool in exchange for liquidity tokens.

Constructors

AddParams 

Fields

Instances

Instances details
Show AddParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

Generic AddParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

Associated Types

type Rep AddParams :: Type -> Type Source #

ToJSON AddParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

FromJSON AddParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

ToSchema AddParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

type Rep AddParams Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

type Rep AddParams = D1 ('MetaData "AddParams" "Plutus.Contracts.Uniswap.OffChain" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" 'False) (C1 ('MetaCons "AddParams" 'PrefixI 'True) ((S1 ('MetaSel ('Just "apCoinA") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Coin A)) :*: S1 ('MetaSel ('Just "apCoinB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Coin B))) :*: (S1 ('MetaSel ('Just "apAmountA") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Amount A)) :*: S1 ('MetaSel ('Just "apAmountB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Amount B)))))

type UniswapUserSchema = ((((((Endpoint "create" CreateParams .\/ Endpoint "swap" SwapParams) .\/ Endpoint "close" CloseParams) .\/ Endpoint "remove" RemoveParams) .\/ Endpoint "add" AddParams) .\/ Endpoint "pools" ()) .\/ Endpoint "funds" ()) .\/ Endpoint "stop" () Source #

Schema for the endpoints for users of Uniswap.

data UserContractState Source #

Type of the Uniswap user contract state.

Instances

Instances details
Show UserContractState Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

Generic UserContractState Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

Associated Types

type Rep UserContractState :: Type -> Type Source #

ToJSON UserContractState Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

FromJSON UserContractState Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

type Rep UserContractState Source # 
Instance details

Defined in Plutus.Contracts.Uniswap.OffChain

type Rep UserContractState = D1 ('MetaData "UserContractState" "Plutus.Contracts.Uniswap.OffChain" "plutus-use-cases-0.1.0.0-sCb7ThsvWbFT6VPXrOzPF" 'False) (((C1 ('MetaCons "Pools" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [((Coin A, Amount A), (Coin B, Amount B))])) :+: C1 ('MetaCons "Funds" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value))) :+: (C1 ('MetaCons "Created" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Swapped" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Added" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Removed" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Closed" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Stopped" 'PrefixI 'False) (U1 :: Type -> Type))))

start :: forall w s. Contract w s Text Uniswap Source #

Creates a Uniswap "factory". This factory will keep track of the existing liquidity pools and enforce that there will be at most one liquidity pool for any pair of tokens at any given time.

create :: forall w s. Uniswap -> CreateParams -> Contract w s Text () Source #

Creates a liquidity pool for a pair of coins. The creator provides liquidity for both coins and gets liquidity tokens in return.

add :: forall w s. Uniswap -> AddParams -> Contract w s Text () Source #

Adds some liquidity to an existing liquidity pool in exchange for newly minted liquidity tokens.

remove :: forall w s. Uniswap -> RemoveParams -> Contract w s Text () Source #

Removes some liquidity from a liquidity pool in exchange for liquidity tokens.

close :: forall w s. Uniswap -> CloseParams -> Contract w s Text () Source #

Closes a liquidity pool by burning all remaining liquidity tokens in exchange for all liquidity remaining in the pool.

swap :: forall w s. Uniswap -> SwapParams -> Contract w s Text () Source #

Uses a liquidity pool two swap one sort of coins in the pool against the other.

pools :: forall w s. Uniswap -> Contract w s Text [((Coin A, Amount A), (Coin B, Amount B))] Source #

Finds all liquidity pools and their liquidity belonging to the Uniswap instance. This merely inspects the blockchain and does not issue any transactions.

userEndpoints :: Uniswap -> Promise (Last (Either Text UserContractState)) UniswapUserSchema Void () Source #

Provides the following endpoints for users of a Uniswap instance:

create
Creates a liquidity pool for a pair of coins. The creator provides liquidity for both coins and gets liquidity tokens in return.
swap
Uses a liquidity pool two swap one sort of coins in the pool against the other.
close
Closes a liquidity pool by burning all remaining liquidity tokens in exchange for all liquidity remaining in the pool.
remove
Removes some liquidity from a liquidity pool in exchange for liquidity tokens.
add
Adds some liquidity to an existing liquidity pool in exchange for newly minted liquidity tokens.
pools
Finds all liquidity pools and their liquidity belonging to the Uniswap instance. This merely inspects the blockchain and does not issue any transactions.
funds
Gets the caller's funds. This merely inspects the blockchain and does not issue any transactions.
stop
Stops the contract.