docs: More docs and improvements of existing docs

- Tried not to leave a single public function undocumented, though did not double-document public function with obvious names
- Remove all mentions of the strategy selector in favour of the strategy registry (to avoid confusion)
This commit is contained in:
TAMARA LIPOWSKI
2025-02-05 16:35:43 -05:00
parent 44e8e0bb96
commit 07457b5f76
10 changed files with 43 additions and 14 deletions

View File

@@ -3,17 +3,23 @@ use crate::encoding::{
models::{EncodingContext, Swap},
};
/// This trait must be implemented in order to encode a swap for a specific protocol.
/// This trait must be implemented in order to encode a single swap for a specific protocol.
pub trait SwapEncoder: Sync + Send {
fn new(executor_address: String) -> Self
where
Self: Sized;
/// Encodes a swap and its relevant context information into call data for a specific protocol.
fn encode_swap(
&self,
swap: Swap,
encoding_context: EncodingContext,
) -> Result<Vec<u8>, EncodingError>;
/// The address of the executor that will be used to swap through a specific protocol.
fn executor_address(&self) -> &str;
/// The selector of the executor function that will be called in order to perform a swap.
fn executor_selector(&self) -> &str;
/// Clones the swap encoder as a trait object.