Skip to content

Commit

Permalink
Merge pull request #509 from Chia-Network/settlement-payments
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity authored May 8, 2024
2 parents 95b1554 + 299fe5d commit f6e8f53
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions crates/chia-puzzles/src/puzzles/offer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
use chia_protocol::{Bytes, Bytes32};
use clvm_traits::{FromClvm, ToClvm};
use hex_literal::hex;

#[derive(Debug, Clone, PartialEq, Eq, ToClvm, FromClvm)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[clvm(tuple)]
pub struct SettlementPaymentsSolution {
pub notarized_payments: Vec<NotarizedPayment>,
}

#[derive(Debug, Clone, PartialEq, Eq, ToClvm, FromClvm)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[clvm(tuple)]
pub struct NotarizedPayment {
pub nonce: Bytes32,
pub payments: Vec<Payment>,
}

#[derive(Debug, Clone, PartialEq, Eq, ToClvm, FromClvm)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[clvm(tuple, untagged)]
pub enum Payment {
WithoutMemos(PaymentWithoutMemos),
WithMemos(PaymentWithMemos),
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, ToClvm, FromClvm)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[clvm(list)]
pub struct PaymentWithoutMemos {
pub puzzle_hash: Bytes32,
pub amount: u64,
}

#[derive(Debug, Clone, PartialEq, Eq, ToClvm, FromClvm)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[clvm(list)]
pub struct PaymentWithMemos {
pub puzzle_hash: Bytes32,
pub amount: u64,
pub memos: Vec<Bytes>,
}

/// This is the puzzle reveal of the [offer settlement payments](https://chialisp.com/offers) puzzle.
pub const SETTLEMENT_PAYMENTS_PUZZLE: [u8; 293] = hex!(
"
Expand Down

0 comments on commit f6e8f53

Please sign in to comment.