Skip to content

Commit

Permalink
feat: tracker refactor and support for vault swaps
Browse files Browse the repository at this point in the history
  • Loading branch information
j4m1ef0rd committed Dec 5, 2024
1 parent 74e50be commit bc331f7
Show file tree
Hide file tree
Showing 3 changed files with 538 additions and 223 deletions.
6 changes: 3 additions & 3 deletions api/bin/chainflip-ingress-egress-tracker/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Store for RedisStore {
type Output = ();

async fn save_to_array<S: Storable>(&mut self, storable: &S) -> anyhow::Result<()> {
let key = storable.get_key();
let key = storable.get_key()?;
self.con
.rpush::<String, String, ()>(key.clone(), serde_json::to_string(storable)?)
.await?;
Expand All @@ -41,7 +41,7 @@ impl Store for RedisStore {
async fn save_singleton<S: Storable>(&mut self, storable: &S) -> anyhow::Result<()> {
self.con
.set_ex::<String, String, ()>(
storable.get_key(),
storable.get_key()?,
serde_json::to_string(storable)?,
storable.get_expiry_duration().as_secs(),
)
Expand All @@ -54,7 +54,7 @@ impl Store for RedisStore {
pub trait Storable: Serialize + Sized + Sync + 'static {
const DEFAULT_EXPIRY_DURATION: Duration = Duration::from_secs(3600);

fn get_key(&self) -> String;
fn get_key(&self) -> anyhow::Result<String>;

fn get_expiry_duration(&self) -> Duration {
Self::DEFAULT_EXPIRY_DURATION
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
source: api/bin/chainflip-ingress-egress-tracker/src/witnessing/state_chain.rs
expression: "store.storage.get(\"vault_deposit:Ethereum:b5c8bd9430b6cc87a0e2fe110ece6bf527fa4f170a4bc8cd032f768fc5219838\").unwrap()"
snapshot_kind: text
---
{"affiliate_fees":[],"amount":"0x64","boost_fee":0,"broker_fee":{"account":"5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM","bps":0},"dca_params":null,"deposit_chain_block_height":1,"deposit_details":null,"deposit_metadata":null,"destination_address":{"Eth":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},"input_asset":{"asset":"ETH","chain":"Ethereum"},"output_asset":{"asset":"FLIP","chain":"Ethereum"},"refund_params":{"min_price":"0x0","refund_address":{"Eth":"0x541f563237a309b3a61e33bdf07a8930bdba8d99"},"retry_duration":0}}
Loading

0 comments on commit bc331f7

Please sign in to comment.