pub struct ProtocolComponent<Token: Into<Address> + Clone = Address> {
pub id: ComponentId,
pub protocol_system: String,
pub protocol_type_name: String,
pub chain: Chain,
pub tokens: Vec<Token>,
pub contract_addresses: Vec<Address>,
pub static_attributes: HashMap<AttrStoreKey, StoreVal>,
pub change: ChangeType,
pub creation_tx: TxHash,
pub created_at: NaiveDateTime,
}Expand description
ProtocolComponent provides detailed descriptions of a component of a protocol,
for example, swap pools that enables the exchange of two tokens.
A ProtocolComponent can be associated with an Account, and it has an identifier (id) that
can be either the on-chain address or a custom one. It belongs to a specific ProtocolSystem
and has a ProtocolTypeID that associates it with a ProtocolType that describes its behaviour
e.g., swap, lend, bridge. The component is associated with a specific Chain and holds
information about tradable tokens, related contract IDs, and static attributes.
Every values of a ProtocolComponent must be static, they can’t ever be changed after creation.
The dynamic values associated to a component must be given using ProtocolComponentState.
Fields§
§id: ComponentId§protocol_system: String§protocol_type_name: String§chain: Chain§tokens: Vec<Token>§contract_addresses: Vec<Address>§static_attributes: HashMap<AttrStoreKey, StoreVal>§change: ChangeType§creation_tx: TxHash§created_at: NaiveDateTimeImplementations§
Source§impl<T> ProtocolComponent<T>
impl<T> ProtocolComponent<T>
pub fn new( id: &str, protocol_system: &str, protocol_type_name: &str, chain: Chain, tokens: Vec<T>, contract_addresses: Vec<Address>, static_attributes: HashMap<AttrStoreKey, StoreVal>, change: ChangeType, creation_tx: TxHash, created_at: NaiveDateTime, ) -> Self
Trait Implementations§
Source§impl<Token: Clone + Into<Address> + Clone> Clone for ProtocolComponent<Token>
impl<Token: Clone + Into<Address> + Clone> Clone for ProtocolComponent<Token>
Source§fn clone(&self) -> ProtocolComponent<Token>
fn clone(&self) -> ProtocolComponent<Token>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl DeepSizeOf for ProtocolComponent
impl DeepSizeOf for ProtocolComponent
Source§fn deep_size_of_children(&self, ctx: &mut Context) -> usize
fn deep_size_of_children(&self, ctx: &mut Context) -> usize
Source§fn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
Source§impl<Token: Default + Into<Address> + Clone> Default for ProtocolComponent<Token>
impl<Token: Default + Into<Address> + Clone> Default for ProtocolComponent<Token>
Source§fn default() -> ProtocolComponent<Token>
fn default() -> ProtocolComponent<Token>
Source§impl<'de, Token> Deserialize<'de> for ProtocolComponent<Token>
impl<'de, Token> Deserialize<'de> for ProtocolComponent<Token>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<T> From<ProtocolComponent<T>> for ProtocolComponent
impl<T> From<ProtocolComponent<T>> for ProtocolComponent
Source§fn from(value: ProtocolComponent<T>) -> Self
fn from(value: ProtocolComponent<T>) -> Self
Source§impl<Token> Serialize for ProtocolComponent<Token>
impl<Token> Serialize for ProtocolComponent<Token>
impl<Token: Eq + Into<Address> + Clone> Eq for ProtocolComponent<Token>
impl<Token: Into<Address> + Clone> StructuralPartialEq for ProtocolComponent<Token>
Auto Trait Implementations§
impl<Token = Bytes> !Freeze for ProtocolComponent<Token>
impl<Token> RefUnwindSafe for ProtocolComponent<Token>where
Token: RefUnwindSafe,
impl<Token> Send for ProtocolComponent<Token>where
Token: Send,
impl<Token> Sync for ProtocolComponent<Token>where
Token: Sync,
impl<Token> Unpin for ProtocolComponent<Token>where
Token: Unpin,
impl<Token> UnsafeUnpin for ProtocolComponent<Token>
impl<Token> UnwindSafe for ProtocolComponent<Token>where
Token: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more