Safe Haskell | None |
---|---|
Language | Haskell2010 |
A multisig contract written as a state machine.
Synopsis
- data Params = Params {
- mspSignatories :: [PaymentPubKeyHash]
- mspRequiredSigs :: Integer
- data Payment = Payment {
- paymentAmount :: Value
- paymentRecipient :: Address
- paymentDeadline :: POSIXTime
- data State s
- mkValidator :: Params -> ValidatorType MultiSigSym
- typedValidator :: Params -> TypedValidator MultiSigSym
- data MultiSigError
- = MSContractError ContractError
- | MSStateMachineError SMContractError
- type MultiSigSchema = (((Endpoint "propose-payment" Payment .\/ Endpoint "add-signature" ()) .\/ Endpoint "cancel-payment" ()) .\/ Endpoint "pay" ()) .\/ Endpoint "lock" Value
- contract :: (AsContractError e, AsSMContractError e) => Params -> Contract () MultiSigSchema e ()
Documentation
The n-out-of-m multisig contract works like a joint account of m people, requiring the consent of n people for any payments. In the smart contract the signatories are represented by public keys, and approval takes the form of signatures on transactions.
The multisig contract in
MultiSig
expects n signatures on
a single transaction. This requires an off-chain communication channel. The
multisig contract implemented in this module uses a proposal system that
allows participants to propose payments and attach their signatures to
proposals over a period of time, using separate transactions. All contract
state is kept on the chain so there is no need for off-chain communication.
Params | |
|
Instances
Lift DefaultUni Params Source # | |
Defined in Plutus.Contracts.MultiSigStateMachine | |
Typeable DefaultUni Params Source # | |
Defined in Plutus.Contracts.MultiSigStateMachine |
A proposal for making a payment under the multisig scheme.
Payment | |
|
Instances
Instances
Eq s => Eq (State s) | |
Show s => Show (State s) | |
Generic (State s) | |
FromJSON s => FromJSON (State s) | |
Defined in Plutus.Contract.StateMachine.OnChain parseJSON :: Value -> Parser (State s) parseJSONList :: Value -> Parser [State s] | |
ToJSON s => ToJSON (State s) | |
Defined in Plutus.Contract.StateMachine.OnChain toEncoding :: State s -> Encoding toJSONList :: [State s] -> Value toEncodingList :: [State s] -> Encoding | |
type Rep (State s) | |
Defined in Plutus.Contract.StateMachine.OnChain type Rep (State s) = D1 ('MetaData "State" "Plutus.Contract.StateMachine.OnChain" "plutus-contract-1.2.0.0-FH8LC9wh7UV4Nmv68NHXrC" 'False) (C1 ('MetaCons "State" 'PrefixI 'True) (S1 ('MetaSel ('Just "stateData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 s) :*: S1 ('MetaSel ('Just "stateValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value))) |
mkValidator :: Params -> ValidatorType MultiSigSym Source #
typedValidator :: Params -> TypedValidator MultiSigSym Source #
data MultiSigError Source #
MSContractError ContractError | |
MSStateMachineError SMContractError |
Instances
type MultiSigSchema = (((Endpoint "propose-payment" Payment .\/ Endpoint "add-signature" ()) .\/ Endpoint "cancel-payment" ()) .\/ Endpoint "pay" ()) .\/ Endpoint "lock" Value Source #
contract :: (AsContractError e, AsSMContractError e) => Params -> Contract () MultiSigSchema e () Source #