1use solana_program::pubkey::Pubkey;
2use steel::*;
3
4#[repr(u8)]
5#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
6pub enum EscrowInstruction {
7 FundPayment = 0, ReleasePayment = 1, RefundPayment = 2, ClosePayment = 3, DisputePayment = 4, ResolveDispute = 5, ExtendPaymentTTL = 6, ConfirmFulfillment = 7, AppealArbitration = 8, Initialize = 100,
20 UpdateAuthority = 101,
21 UpdateConfig = 102,
22 OpenEscrow = 103,
23 PauseEscrow = 104,
24 UpdateEscrowSettings = 105,
25 CloseEscrow = 106,
26 ArbitratePayment = 107, WithdrawFees = 108, }
29
30#[repr(C)]
31#[derive(Clone, Copy, Debug, Pod, Zeroable)]
32pub struct Initialize {
33 pub fee_bps: [u8; 2], pub _padding: [u8; 6], }
36
37#[repr(C)]
38#[derive(Clone, Copy, Debug, Pod, Zeroable)]
39pub struct UpdateAuthority {
40 pub new_authority: Pubkey,
41}
42
43#[repr(C)]
44#[derive(Clone, Copy, Debug, Pod, Zeroable)]
45pub struct FundPayment {
46 pub seller: Pubkey, pub mint: Pubkey, pub amount: [u8; 8], pub ttl_seconds: [u8; 8], pub reference: Pubkey, pub payment_uid: [u8; 32], pub order_num: [u8; 32], }
55
56#[repr(C)]
57#[derive(Clone, Copy, Debug, Pod, Zeroable)]
58pub struct ReleasePayment {}
59
60#[repr(C)]
61#[derive(Clone, Copy, Debug, Pod, Zeroable)]
62pub struct RefundPayment {}
63
64#[repr(C)]
65#[derive(Clone, Copy, Debug, Pod, Zeroable)]
66pub struct ClosePayment {}
67
68#[repr(C)]
69#[derive(Clone, Copy, Debug, Pod, Zeroable)]
70pub struct WithdrawFees {
71 pub amount: [u8; 8], }
73
74#[repr(C)]
76#[derive(Clone, Copy, Debug, Pod, Zeroable)]
77pub struct DisputePayment {
78 pub reason: u8, pub description: [u8; 64], }
82
83#[repr(C)]
84#[derive(Clone, Copy, Debug, Pod, Zeroable)]
85pub struct ResolveDispute {
86 pub buyer_amount: [u8; 8], pub seller_amount: [u8; 8], pub decision: u8, pub _padding: [u8; 7], }
92
93#[repr(C)]
94#[derive(Clone, Copy, Debug, Pod, Zeroable)]
95pub struct ExtendPaymentTTL {
96 pub additional_seconds: [u8; 8], }
98
99#[repr(C)]
101#[derive(Clone, Copy, Debug, Pod, Zeroable)]
102pub struct ArbitratePayment {
103 pub buyer_amount: [u8; 8], pub seller_amount: [u8; 8], pub decision: u8, pub reason: u8, pub description: [u8; 64], pub _padding: [u8; 6], }
111
112#[repr(C)]
113#[derive(Clone, Copy, Debug, Pod, Zeroable)]
114pub struct CloseEscrow {}
115
116#[repr(C)]
117#[derive(Clone, Copy, Debug, Pod, Zeroable)]
118pub struct UpdateEscrowSettings {
119 pub min_payment_amount: [u8; 8], pub max_payment_amount: [u8; 8], pub new_fee_bps: [u8; 2], pub _padding: [u8; 6], }
125
126#[repr(C)]
127#[derive(Clone, Copy, Debug, Pod, Zeroable)]
128pub struct PauseEscrow {
129 pub pause: u8, }
131
132#[repr(C)]
133#[derive(Clone, Copy, Debug, Pod, Zeroable)]
134pub struct UpdateConfig {
135 pub appeal_window_seconds: [u8; 8], pub closure_delay_seconds: [u8; 8], pub max_appeals: u8, pub _padding: [u8; 7], }
141
142#[repr(C)]
143#[derive(Clone, Copy, Debug, Pod, Zeroable)]
144pub struct ConfirmFulfillment {}
145
146#[repr(C)]
147#[derive(Clone, Copy, Debug, Pod, Zeroable)]
148pub struct AppealArbitration {
149 pub description: [u8; 64], pub reason: u8, pub _padding: [u8; 7], }
153
154#[repr(C)]
155#[derive(Clone, Copy, Debug, Pod, Zeroable)]
156pub struct OpenEscrow {
157 pub min_payment_amount: [u8; 8], pub max_payment_amount: [u8; 8], pub fee_bps: [u8; 2], pub _padding: [u8; 6], }
163
164instruction!(EscrowInstruction, FundPayment);
165instruction!(EscrowInstruction, ReleasePayment);
166instruction!(EscrowInstruction, RefundPayment);
167instruction!(EscrowInstruction, ClosePayment);
168instruction!(EscrowInstruction, DisputePayment);
169instruction!(EscrowInstruction, ResolveDispute);
170instruction!(EscrowInstruction, ExtendPaymentTTL);
171instruction!(EscrowInstruction, ConfirmFulfillment);
172instruction!(EscrowInstruction, AppealArbitration);
173
174instruction!(EscrowInstruction, Initialize);
175instruction!(EscrowInstruction, OpenEscrow);
176instruction!(EscrowInstruction, UpdateAuthority);
177instruction!(EscrowInstruction, WithdrawFees);
178instruction!(EscrowInstruction, ArbitratePayment);
179instruction!(EscrowInstruction, CloseEscrow);
180instruction!(EscrowInstruction, UpdateEscrowSettings);
181instruction!(EscrowInstruction, PauseEscrow);
182instruction!(EscrowInstruction, UpdateConfig);