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, ExtendPaymentTTL = 4, SubmitDelivery = 5, ConfirmOracle = 6, Initialize = 100,
18 UpdateAuthority = 101,
19 UpdateConfig = 102,
20 OpenEscrow = 103,
21 PauseEscrow = 104,
22 UpdateEscrowSettings = 105,
23 CloseEscrow = 106,
24 WithdrawFees = 107, }
26
27#[repr(C)]
28#[derive(Clone, Copy, Debug, Pod, Zeroable)]
29pub struct Initialize {
30 pub fee_bps: [u8; 2], pub _padding: [u8; 6], }
33
34#[repr(C)]
35#[derive(Clone, Copy, Debug, Pod, Zeroable)]
36pub struct UpdateAuthority {
37 pub new_authority: Pubkey,
38}
39
40#[repr(C)]
41#[derive(Clone, Copy, Debug, Pod, Zeroable)]
42pub struct FundPayment {
43 pub seller: Pubkey, pub mint: Pubkey, pub oracle_authority: Pubkey, pub payment_uid: [u8; 32], pub sla_hash: [u8; 32], pub amount: [u8; 8], pub ttl_seconds: [u8; 8], }
51
52#[repr(C)]
53#[derive(Clone, Copy, Debug, Pod, Zeroable)]
54pub struct ReleasePayment {}
55
56#[repr(C)]
57#[derive(Clone, Copy, Debug, Pod, Zeroable)]
58pub struct RefundPayment {}
59
60#[repr(C)]
61#[derive(Clone, Copy, Debug, Pod, Zeroable)]
62pub struct SubmitDelivery {
63 pub delivery_hash: [u8; 32], }
65
66#[repr(C)]
67#[derive(Clone, Copy, Debug, Pod, Zeroable)]
68pub struct ClosePayment {}
69
70#[repr(C)]
71#[derive(Clone, Copy, Debug, Pod, Zeroable)]
72pub struct WithdrawFees {
73 pub amount: [u8; 8], }
75
76#[repr(C)]
77#[derive(Clone, Copy, Debug, Pod, Zeroable)]
78pub struct ExtendPaymentTTL {
79 pub additional_seconds: [u8; 8], }
81
82#[repr(C)]
83#[derive(Clone, Copy, Debug, Pod, Zeroable)]
84pub struct CloseEscrow {}
85
86#[repr(C)]
87#[derive(Clone, Copy, Debug, Pod, Zeroable)]
88pub struct UpdateEscrowSettings {
89 pub min_payment_amount: [u8; 8], pub max_payment_amount: [u8; 8], pub min_fee_amount: [u8; 8], pub new_fee_bps: [u8; 2], pub _padding: [u8; 6], }
95
96#[repr(C)]
97#[derive(Clone, Copy, Debug, Pod, Zeroable)]
98pub struct PauseEscrow {
99 pub pause: u8, }
101
102#[repr(C)]
103#[derive(Clone, Copy, Debug, Pod, Zeroable)]
104pub struct UpdateConfig {
105 pub closure_delay_seconds: [u8; 8], pub refund_cooldown_seconds: [u8; 8], }
109
110#[repr(C)]
111#[derive(Clone, Copy, Debug, Pod, Zeroable)]
112pub struct OpenEscrow {
113 pub min_payment_amount: [u8; 8], pub max_payment_amount: [u8; 8], pub min_fee_amount: [u8; 8], pub fee_bps: [u8; 2], pub _padding: [u8; 6], }
119
120#[repr(C)]
121#[derive(Clone, Copy, Debug, Pod, Zeroable)]
122pub struct ConfirmOracle {
123 pub delivery_hash: [u8; 32], pub resolution_state: u8, pub _padding: [u8; 7], }
128
129instruction!(EscrowInstruction, FundPayment);
130instruction!(EscrowInstruction, ReleasePayment);
131instruction!(EscrowInstruction, RefundPayment);
132instruction!(EscrowInstruction, ClosePayment);
133instruction!(EscrowInstruction, ExtendPaymentTTL);
134instruction!(EscrowInstruction, SubmitDelivery);
135instruction!(EscrowInstruction, ConfirmOracle);
136
137instruction!(EscrowInstruction, Initialize);
138instruction!(EscrowInstruction, OpenEscrow);
139instruction!(EscrowInstruction, UpdateAuthority);
140instruction!(EscrowInstruction, WithdrawFees);
141instruction!(EscrowInstruction, CloseEscrow);
142instruction!(EscrowInstruction, UpdateEscrowSettings);
143instruction!(EscrowInstruction, PauseEscrow);
144instruction!(EscrowInstruction, UpdateConfig);