diff --git a/crates/chia-puzzles/src/puzzles/offer.rs b/crates/chia-puzzles/src/puzzles/offer.rs index 77c398da6..1be9b38b2 100644 --- a/crates/chia-puzzles/src/puzzles/offer.rs +++ b/crates/chia-puzzles/src/puzzles/offer.rs @@ -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, +} + +#[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, +} + +#[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, +} + /// This is the puzzle reveal of the [offer settlement payments](https://chialisp.com/offers) puzzle. pub const SETTLEMENT_PAYMENTS_PUZZLE: [u8; 293] = hex!( "