|
| 1 | +use steel::*; |
| 2 | + |
| 3 | +#[repr(u8)] |
| 4 | +#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)] |
| 5 | +pub enum TokenSwapInstruction { |
| 6 | + CreateAmm = 0, |
| 7 | + CreatePool = 1, |
| 8 | + DepositLiquidity = 2, |
| 9 | + WithdrawLiquidity = 3, |
| 10 | + Swap = 4, |
| 11 | +} |
| 12 | + |
| 13 | +#[repr(C)] |
| 14 | +#[derive(Clone, Copy, Debug, Pod, Zeroable)] |
| 15 | +pub struct CreateAmm { |
| 16 | + pub id: Pubkey, |
| 17 | + pub fee: [u8; 2], |
| 18 | +} |
| 19 | + |
| 20 | +#[repr(C)] |
| 21 | +#[derive(Clone, Copy, Debug, Pod, Zeroable)] |
| 22 | +pub struct CreatePool {} |
| 23 | + |
| 24 | +#[repr(C)] |
| 25 | +#[derive(Clone, Copy, Debug, Pod, Zeroable)] |
| 26 | +pub struct DepositLiquidity { |
| 27 | + pub amount_a: [u8; 8], |
| 28 | + pub amount_b: [u8; 8], |
| 29 | +} |
| 30 | + |
| 31 | +#[repr(C)] |
| 32 | +#[derive(Clone, Copy, Debug, Pod, Zeroable)] |
| 33 | +pub struct WithdrawLiquidity { |
| 34 | + pub amount: [u8; 8], |
| 35 | +} |
| 36 | + |
| 37 | +#[repr(C)] |
| 38 | +#[derive(Clone, Copy, Debug, Pod, Zeroable)] |
| 39 | +pub struct Swap { |
| 40 | + pub swap_a: u8, |
| 41 | + pub input_amount: [u8; 8], |
| 42 | + pub min_output_amount: [u8; 8], |
| 43 | +} |
| 44 | + |
| 45 | +instruction!(TokenSwapInstruction, CreateAmm); |
| 46 | +instruction!(TokenSwapInstruction, CreatePool); |
| 47 | +instruction!(TokenSwapInstruction, DepositLiquidity); |
| 48 | +instruction!(TokenSwapInstruction, WithdrawLiquidity); |
| 49 | +instruction!(TokenSwapInstruction, Swap); |
0 commit comments