-
Notifications
You must be signed in to change notification settings - Fork 9
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
1 parent
5f4fb86
commit 147cafa
Showing
9 changed files
with
306 additions
and
166 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
#[allow(unused)] | ||
use dfmm_kit::behaviors::*; | ||
|
||
// #[arbiter_macros::main( | ||
// name = "DFMM Kit", | ||
// about = "Our entrypoint to working with the DFMM Kit.", | ||
// behaviors = Behaviors | ||
// )] | ||
// To run this, you can do `cargo run --bin kit` to access the binary in debug | ||
// mode. You can also `cargo install --path kit --bin kit --force` to install | ||
// the binary and run it with `kit`. This will be the release profile. | ||
#[arbiter_macros::main( | ||
name = "DFMM Kit", | ||
about = "Our entrypoint to working with the DFMM Kit.", | ||
behaviors = Behaviors | ||
)] | ||
pub fn main() {} |
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
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
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,23 @@ | ||
use super::*; | ||
|
||
#[derive(Deserialize, Serialize, Clone, Debug)] | ||
pub struct OnCommand { | ||
pub amount: eU256, | ||
pub input: InputToken, | ||
} | ||
|
||
impl SwapType<Message> for OnCommand { | ||
fn compute_swap_amount(&self, event: Message) -> Option<(eU256, InputToken)> { | ||
debug!("Inside compute swap amount for `SwapOnCommand`"); | ||
match serde_json::from_str::<ExecuteSwap>(&event.data) { | ||
Ok(_) => { | ||
debug!("Successfully deserialized message data for `SwapOnCommand`"); | ||
Some((self.amount, self.input)) | ||
} | ||
Err(_) => None, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Clone)] | ||
pub struct ExecuteSwap; |
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
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
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