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, UpdateConfig = 102,
20 OpenEscrow = 103,
21 PauseEscrow = 104,
22 UpdateEscrowSettings = 105,
23 CloseEscrow = 106,
24 WithdrawFees = 107, AcceptAuthority = 108, CancelAuthorityProposal = 109, }
28
29#[repr(C)]
30#[derive(Clone, Copy, Debug, Pod, Zeroable)]
31pub struct Initialize {
32 pub fee_bps: [u8; 2], pub _padding: [u8; 6], }
35
36#[repr(C)]
37#[derive(Clone, Copy, Debug, Pod, Zeroable)]
38pub struct UpdateAuthority {
39 pub new_authority: Pubkey,
40}
41
42#[repr(C)]
43#[derive(Clone, Copy, Debug, Pod, Zeroable)]
44pub struct FundPayment {
45 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], }
53
54#[repr(C)]
55#[derive(Clone, Copy, Debug, Pod, Zeroable)]
56pub struct ReleasePayment {}
57
58#[repr(C)]
59#[derive(Clone, Copy, Debug, Pod, Zeroable)]
60pub struct RefundPayment {}
61
62#[repr(C)]
63#[derive(Clone, Copy, Debug, Pod, Zeroable)]
64pub struct SubmitDelivery {
65 pub delivery_hash: [u8; 32], }
67
68#[repr(C)]
69#[derive(Clone, Copy, Debug, Pod, Zeroable)]
70pub struct ClosePayment {}
71
72#[repr(C)]
73#[derive(Clone, Copy, Debug, Pod, Zeroable)]
74pub struct WithdrawFees {
75 pub amount: [u8; 8], }
77
78#[repr(C)]
79#[derive(Clone, Copy, Debug, Pod, Zeroable)]
80pub struct ExtendPaymentTTL {
81 pub additional_seconds: [u8; 8], }
83
84#[repr(C)]
85#[derive(Clone, Copy, Debug, Pod, Zeroable)]
86pub struct CloseEscrow {}
87
88#[repr(C)]
89#[derive(Clone, Copy, Debug, Pod, Zeroable)]
90pub struct UpdateEscrowSettings {
91 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 new_oracle_fee_bps: [u8; 2], pub _padding: [u8; 4], }
98
99#[repr(C)]
100#[derive(Clone, Copy, Debug, Pod, Zeroable)]
101pub struct PauseEscrow {
102 pub pause: u8, }
104
105#[repr(C)]
106#[derive(Clone, Copy, Debug, Pod, Zeroable)]
107pub struct UpdateConfig {
108 pub closure_delay_seconds: [u8; 8], pub refund_cooldown_seconds: [u8; 8], pub delivery_cutoff_seconds: [u8; 8], }
113
114#[repr(C)]
115#[derive(Clone, Copy, Debug, Pod, Zeroable)]
116pub struct OpenEscrow {
117 pub min_payment_amount: [u8; 8], pub max_payment_amount: [u8; 8], pub min_fee_amount: [u8; 8], pub fee_bps: [u8; 2], pub oracle_fee_bps: [u8; 2], pub _padding: [u8; 4], }
124
125#[repr(C)]
126#[derive(Clone, Copy, Debug, Pod, Zeroable)]
127pub struct ConfirmOracle {
128 pub delivery_hash: [u8; 32], pub resolution_hash: [u8; 32], pub resolution_reason: [u8; 2], pub resolution_state: u8, pub _padding: [u8; 5], }
134
135#[repr(C)]
136#[derive(Clone, Copy, Debug, Pod, Zeroable)]
137pub struct AcceptAuthority {}
138
139#[repr(C)]
140#[derive(Clone, Copy, Debug, Pod, Zeroable)]
141pub struct CancelAuthorityProposal {}
142
143instruction!(EscrowInstruction, FundPayment);
144instruction!(EscrowInstruction, ReleasePayment);
145instruction!(EscrowInstruction, RefundPayment);
146instruction!(EscrowInstruction, ClosePayment);
147instruction!(EscrowInstruction, ExtendPaymentTTL);
148instruction!(EscrowInstruction, SubmitDelivery);
149instruction!(EscrowInstruction, ConfirmOracle);
150
151instruction!(EscrowInstruction, Initialize);
152instruction!(EscrowInstruction, OpenEscrow);
153instruction!(EscrowInstruction, UpdateAuthority);
154instruction!(EscrowInstruction, AcceptAuthority);
155instruction!(EscrowInstruction, CancelAuthorityProposal);
156instruction!(EscrowInstruction, WithdrawFees);
157instruction!(EscrowInstruction, CloseEscrow);
158instruction!(EscrowInstruction, UpdateEscrowSettings);
159instruction!(EscrowInstruction, PauseEscrow);
160instruction!(EscrowInstruction, UpdateConfig);