| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Plutus.Contracts.SimpleEscrow
Description
This simple escrow contract facilitiates and exchange of currencies.
Synopsis
- data EscrowParams = EscrowParams {}
- type EscrowSchema = (Endpoint "lock" EscrowParams .\/ Endpoint "refund" EscrowParams) .\/ Endpoint "redeem" EscrowParams
- data Action
- data RedeemFailReason = DeadlinePassed
- data EscrowError
- = RedeemFailed RedeemFailReason
- | RefundFailed
- | EContractError ContractError
- class AsEscrowError r where
- _EscrowError :: Prism' r EscrowError
- _RedeemFailed :: Prism' r RedeemFailReason
- _RefundFailed :: Prism' r ()
- _EContractError :: Prism' r ContractError
- newtype RefundSuccess = RefundSuccess TxId
- newtype RedeemSuccess = RedeemSuccess TxId
- data Escrow
- escrowAddress :: CardanoAddress
- escrowInstance :: TypedValidator Escrow
- validate :: EscrowParams -> Action -> ScriptContext -> Bool
- lockEp :: Promise () EscrowSchema EscrowError ()
- redeemEp :: Promise () EscrowSchema EscrowError RedeemSuccess
- refundEp :: Promise () EscrowSchema EscrowError RefundSuccess
Documentation
data EscrowParams Source #
Constructors
| EscrowParams | |
Instances
type EscrowSchema = (Endpoint "lock" EscrowParams .\/ Endpoint "refund" EscrowParams) .\/ Endpoint "redeem" EscrowParams Source #
Instances
| ToData Action Source # | |
Defined in Plutus.Contracts.SimpleEscrow Methods toBuiltinData :: Action -> BuiltinData | |
| FromData Action Source # | |
Defined in Plutus.Contracts.SimpleEscrow Methods fromBuiltinData :: BuiltinData -> Maybe Action | |
| UnsafeFromData Action Source # | |
Defined in Plutus.Contracts.SimpleEscrow Methods unsafeFromBuiltinData :: BuiltinData -> Action | |
| Lift DefaultUni Action Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
| Typeable DefaultUni Action Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
data RedeemFailReason Source #
Constructors
| DeadlinePassed |
Instances
| Eq RedeemFailReason Source # | |
Defined in Plutus.Contracts.SimpleEscrow Methods (==) :: RedeemFailReason -> RedeemFailReason -> Bool Source # (/=) :: RedeemFailReason -> RedeemFailReason -> Bool Source # | |
| Show RedeemFailReason Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
| Generic RedeemFailReason Source # | |
Defined in Plutus.Contracts.SimpleEscrow Methods from :: RedeemFailReason -> Rep RedeemFailReason x Source # to :: Rep RedeemFailReason x -> RedeemFailReason Source # | |
| FromJSON RedeemFailReason Source # | |
Defined in Plutus.Contracts.SimpleEscrow Methods parseJSON :: Value -> Parser RedeemFailReason parseJSONList :: Value -> Parser [RedeemFailReason] | |
| ToJSON RedeemFailReason Source # | |
Defined in Plutus.Contracts.SimpleEscrow Methods toJSON :: RedeemFailReason -> Value toEncoding :: RedeemFailReason -> Encoding toJSONList :: [RedeemFailReason] -> Value toEncodingList :: [RedeemFailReason] -> Encoding | |
| type Rep RedeemFailReason Source # | |
data EscrowError Source #
Constructors
| RedeemFailed RedeemFailReason | |
| RefundFailed | |
| EContractError ContractError |
Instances
class AsEscrowError r where Source #
Minimal complete definition
Methods
_EscrowError :: Prism' r EscrowError Source #
_RedeemFailed :: Prism' r RedeemFailReason Source #
_RefundFailed :: Prism' r () Source #
_EContractError :: Prism' r ContractError Source #
Instances
| AsEscrowError EscrowError Source # | |
Defined in Plutus.Contracts.SimpleEscrow Methods _EscrowError :: Prism' EscrowError EscrowError Source # _RedeemFailed :: Prism' EscrowError RedeemFailReason Source # _RefundFailed :: Prism' EscrowError () Source # _EContractError :: Prism' EscrowError ContractError Source # | |
newtype RefundSuccess Source #
Constructors
| RefundSuccess TxId |
Instances
| Eq RefundSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow Methods (==) :: RefundSuccess -> RefundSuccess -> Bool Source # (/=) :: RefundSuccess -> RefundSuccess -> Bool Source # | |
| Show RefundSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
| Generic RefundSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow Methods from :: RefundSuccess -> Rep RefundSuccess x Source # to :: Rep RefundSuccess x -> RefundSuccess Source # | |
| FromJSON RefundSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
| ToJSON RefundSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow Methods toJSON :: RefundSuccess -> Value toEncoding :: RefundSuccess -> Encoding toJSONList :: [RefundSuccess] -> Value toEncodingList :: [RefundSuccess] -> Encoding | |
| type Rep RefundSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
newtype RedeemSuccess Source #
Constructors
| RedeemSuccess TxId |
Instances
| Eq RedeemSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow Methods (==) :: RedeemSuccess -> RedeemSuccess -> Bool Source # (/=) :: RedeemSuccess -> RedeemSuccess -> Bool Source # | |
| Show RedeemSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
Instances
| ValidatorTypes Escrow Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
| type DatumType Escrow Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
| type RedeemerType Escrow Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
escrowAddress :: CardanoAddress Source #
escrowInstance :: TypedValidator Escrow Source #
lockEp :: Promise () EscrowSchema EscrowError () Source #
redeemEp :: Promise () EscrowSchema EscrowError RedeemSuccess Source #
Attempts to redeem the Value locked into this script by paying in from
the callers address to the payee.
refundEp :: Promise () EscrowSchema EscrowError RefundSuccess Source #
Refunds the locked amount back to the payee.