use solana_program::pubkey::Pubkey;
use steel::*;
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
pub enum EscrowInstruction {
FundPayment = 0, ReleasePayment = 1, RefundPayment = 2, ClosePayment = 3, ExtendPaymentTTL = 4, SubmitDelivery = 5, ConfirmOracle = 6,
Initialize = 100,
UpdateAuthority = 101,
UpdateConfig = 102,
OpenEscrow = 103,
PauseEscrow = 104,
UpdateEscrowSettings = 105,
CloseEscrow = 106,
WithdrawFees = 107, }
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct Initialize {
pub fee_bps: [u8; 2], pub _padding: [u8; 6], }
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct UpdateAuthority {
pub new_authority: Pubkey,
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct FundPayment {
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], }
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct ReleasePayment {}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct RefundPayment {}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct SubmitDelivery {
pub delivery_hash: [u8; 32], }
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct ClosePayment {}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct WithdrawFees {
pub amount: [u8; 8], }
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct ExtendPaymentTTL {
pub additional_seconds: [u8; 8], }
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct CloseEscrow {}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct UpdateEscrowSettings {
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], }
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct PauseEscrow {
pub pause: u8, }
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct UpdateConfig {
pub closure_delay_seconds: [u8; 8], pub refund_cooldown_seconds: [u8; 8], }
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct OpenEscrow {
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], }
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct ConfirmOracle {
pub delivery_hash: [u8; 32],
pub resolution_state: u8, pub _padding: [u8; 7], }
instruction!(EscrowInstruction, FundPayment);
instruction!(EscrowInstruction, ReleasePayment);
instruction!(EscrowInstruction, RefundPayment);
instruction!(EscrowInstruction, ClosePayment);
instruction!(EscrowInstruction, ExtendPaymentTTL);
instruction!(EscrowInstruction, SubmitDelivery);
instruction!(EscrowInstruction, ConfirmOracle);
instruction!(EscrowInstruction, Initialize);
instruction!(EscrowInstruction, OpenEscrow);
instruction!(EscrowInstruction, UpdateAuthority);
instruction!(EscrowInstruction, WithdrawFees);
instruction!(EscrowInstruction, CloseEscrow);
instruction!(EscrowInstruction, UpdateEscrowSettings);
instruction!(EscrowInstruction, PauseEscrow);
instruction!(EscrowInstruction, UpdateConfig);