diff --git a/stable-swap-anchor/src/state.rs b/stable-swap-anchor/src/state.rs index 31c17e2..f9aa0e2 100644 --- a/stable-swap-anchor/src/state.rs +++ b/stable-swap-anchor/src/state.rs @@ -41,3 +41,12 @@ impl anchor_lang::AccountSerialize for SwapInfo { } } +impl anchor_lang::AccountDeserialize for SwapInfo { + fn try_deserialize(buf: &mut &[u8]) -> Result { + SwapInfo::try_deserialize_unchecked(buf) + } + + fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result { + Ok(stable_swap_client::state::SwapInfo::unpack(buf).map(SwapInfo)?) + } +}