1mod tx;
25mod txout;
26mod spk;
27
28use bc::Tx;
29use commit_verify::mpc::Commitment;
30use commit_verify::{CommitmentProtocol, EmbedCommitVerify, EmbedVerifyError};
31use strict_encoding::{StrictDeserialize, StrictSerialize};
32
33use crate::proof::Method;
34use crate::{Proof, LIB_NAME_BPCORE};
35
36pub enum OpretFirst {}
39
40impl CommitmentProtocol for OpretFirst {}
41
42#[derive(Clone, Eq, PartialEq, Debug, Display, Error, From)]
44#[cfg_attr(
45 feature = "serde",
46 derive(Serialize, Deserialize),
47 serde(crate = "serde_crate", rename_all = "camelCase")
48)]
49#[display(doc_comments)]
50pub enum OpretError {
51 NoOpretOutput,
53
54 InvalidOpretScript,
57}
58
59#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Default)]
61#[derive(StrictType, StrictEncode, StrictDecode)]
62#[strict_type(lib = LIB_NAME_BPCORE)]
63#[cfg_attr(
64 feature = "serde",
65 derive(Serialize, Deserialize),
66 serde(crate = "serde_crate", rename_all = "camelCase")
67)]
68pub struct OpretProof(());
69
70impl StrictSerialize for OpretProof {}
71impl StrictDeserialize for OpretProof {}
72
73impl Proof<Method> for OpretProof {
74 type Error = EmbedVerifyError<OpretError>;
75
76 fn method(&self) -> Method { Method::OpretFirst }
77
78 fn verify(&self, msg: &Commitment, tx: &Tx) -> Result<(), EmbedVerifyError<OpretError>> {
79 tx.verify(msg, self)
80 }
81}