Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 #
Instances
type EscrowSchema = (Endpoint "lock" EscrowParams .\/ Endpoint "refund" EscrowParams) .\/ Endpoint "redeem" EscrowParams Source #
Instances
ToData Action Source # | |
Defined in Plutus.Contracts.SimpleEscrow toBuiltinData :: Action -> BuiltinData | |
FromData Action Source # | |
Defined in Plutus.Contracts.SimpleEscrow fromBuiltinData :: BuiltinData -> Maybe Action | |
UnsafeFromData Action Source # | |
Defined in Plutus.Contracts.SimpleEscrow unsafeFromBuiltinData :: BuiltinData -> Action | |
Lift DefaultUni Action Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
Typeable DefaultUni Action Source # | |
Defined in Plutus.Contracts.SimpleEscrow |
data RedeemFailReason Source #
Instances
Eq RedeemFailReason Source # | |
Defined in Plutus.Contracts.SimpleEscrow (==) :: RedeemFailReason -> RedeemFailReason -> Bool Source # (/=) :: RedeemFailReason -> RedeemFailReason -> Bool Source # | |
Show RedeemFailReason Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
Generic RedeemFailReason Source # | |
Defined in Plutus.Contracts.SimpleEscrow from :: RedeemFailReason -> Rep RedeemFailReason x Source # to :: Rep RedeemFailReason x -> RedeemFailReason Source # | |
FromJSON RedeemFailReason Source # | |
Defined in Plutus.Contracts.SimpleEscrow parseJSON :: Value -> Parser RedeemFailReason parseJSONList :: Value -> Parser [RedeemFailReason] | |
ToJSON RedeemFailReason Source # | |
Defined in Plutus.Contracts.SimpleEscrow toJSON :: RedeemFailReason -> Value toEncoding :: RedeemFailReason -> Encoding toJSONList :: [RedeemFailReason] -> Value toEncodingList :: [RedeemFailReason] -> Encoding | |
type Rep RedeemFailReason Source # | |
data EscrowError Source #
RedeemFailed RedeemFailReason | |
RefundFailed | |
EContractError ContractError |
Instances
class AsEscrowError r where Source #
_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 _EscrowError :: Prism' EscrowError EscrowError Source # _RedeemFailed :: Prism' EscrowError RedeemFailReason Source # _RefundFailed :: Prism' EscrowError () Source # _EContractError :: Prism' EscrowError ContractError Source # |
newtype RefundSuccess Source #
RefundSuccess TxId |
Instances
Eq RefundSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow (==) :: RefundSuccess -> RefundSuccess -> Bool Source # (/=) :: RefundSuccess -> RefundSuccess -> Bool Source # | |
Show RefundSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow | |
Generic RefundSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow from :: RefundSuccess -> Rep RefundSuccess x Source # to :: Rep RefundSuccess x -> RefundSuccess Source # | |
FromJSON RefundSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow parseJSON :: Value -> Parser RefundSuccess parseJSONList :: Value -> Parser [RefundSuccess] | |
ToJSON RefundSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow toJSON :: RefundSuccess -> Value toEncoding :: RefundSuccess -> Encoding toJSONList :: [RefundSuccess] -> Value toEncodingList :: [RefundSuccess] -> Encoding | |
type Rep RefundSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow |
newtype RedeemSuccess Source #
RedeemSuccess TxId |
Instances
Eq RedeemSuccess Source # | |
Defined in Plutus.Contracts.SimpleEscrow (==) :: 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
.