contract MultiCSV(
bob: PublicKey,
carol: PublicKey,
bobDelay: Duration,
carolDelay: Duration,
val: Value
) {
clause bobSpend(sig: Signature) {
verify checkSig(bob, sig)
verify older(bobDelay)
unlock val
}
clause carolSpend(sig: Signature) {
verify checkSig(carol, sig)
verify older(carolDelay)
unlock val
}
clause bothSpend(bobSig: Signature, carolSig: Signature) {
verify checkMultiSig([bob, carol], [bobSig, carolSig])
unlock val
}
}
PUSH(carolKey) PUSH(bobKey) 2 PICK 2 EQUAL IF ROT DROP 0 4 ROLL 4 ROLL 2 2ROT 2 CHECKMULTISIG ELSE ROT IF DROP CHECKSIGVERIFY PUSH(carolDelay) CHECKSEQUENCEVERIFY DROP 1 ELSE NIP CHECKSIGVERIFY PUSH(bobDelay) CHECKSEQUENCEVERIFY DROP 1 ENDIF ENDIF