-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
119 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ members = [ | |
"mfm_cli", | ||
"mfm_machine", | ||
"mfm_machine_derive", | ||
"mfm_core", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "mfm_core" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
serde = "1.0.193" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use std::collections::HashMap; | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] | ||
pub enum Kind { | ||
EVM, | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
pub struct Network { | ||
pub name: String, | ||
pub kind: Kind, | ||
pub symbol: String, | ||
pub decimals: Option<u8>, | ||
pub chain_id: u32, | ||
pub node_url: String, | ||
pub node_url_failover: Option<String>, | ||
pub blockexplorer_url: Option<String>, | ||
pub min_balance_coin: f64, | ||
pub wrapped_asset: Option<Token>, | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
pub struct Networks(HashMap<String, Network>); | ||
impl Networks { | ||
pub fn get(&self, key: &str) -> Option<&Network> { | ||
self.0.get(key) | ||
} | ||
pub fn hashmap(&self) -> &HashMap<String, Network> { | ||
&self.0 | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] | ||
pub struct Dex { | ||
pub name: String, | ||
pub kind: Kind, | ||
pub router_address: String, | ||
pub factory_address: String, | ||
pub network_id: String, | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] | ||
pub struct Dexes(HashMap<String, Dex>); | ||
impl Dexes { | ||
pub fn hashmap(&self) -> &HashMap<String, Dex> { | ||
&self.0 | ||
} | ||
pub fn get(&self, key: &str) -> Option<&Dex> { | ||
self.0.get(key) | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
pub struct TokenNetwork { | ||
pub(crate) name: String, | ||
pub(crate) network_id: String, | ||
pub(crate) address: String, | ||
pub(crate) slippage: f64, | ||
pub(crate) path_asset: String, | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
pub struct TokenNetworks(HashMap<String, TokenNetwork>); | ||
|
||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
pub struct Token { | ||
pub(crate) kind: String, | ||
pub(crate) networks: TokenNetworks, | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
pub struct Tokens(HashMap<String, Token>); | ||
impl Tokens { | ||
pub fn hashmap(&self) -> &HashMap<String, Token> { | ||
&self.0 | ||
} | ||
|
||
pub fn get(&self, key: &str) -> Option<&Token> { | ||
self.0.get(key) | ||
} | ||
} | ||
|
||
pub struct Config { | ||
pub networks: Networks, | ||
pub dexes: Dexes, | ||
pub tokens: Tokens, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pub mod config; | ||
pub mod states; | ||
pub mod tasks; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use crate::config::Config; | ||
|
||
pub struct ReadConfig { | ||
pub config: Config, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|