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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user