Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Add necessary reward event (#89)
Browse files Browse the repository at this point in the history
* Refactor the total reward cal

* Code Clean

* Fix test

* Add OrderCreated event

* Self review

* Update comment

* Update OrderCreate event to include relayers

* Fix review
  • Loading branch information
boundless-forest authored and jiguantong committed Sep 29, 2022
1 parent fc601ce commit 78a6bbc
Show file tree
Hide file tree
Showing 3 changed files with 207 additions and 484 deletions.
9 changes: 0 additions & 9 deletions modules/fee-market/src/s2s/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ impl<T: Config<I>, I: 'static> OnMessageAccepted for FeeMarketMessageAcceptedHan
assigned_relayers.clone(),
T::Slot::get(),
);

// Store the create order
<Orders<T, I>>::insert((order.lane, order.message), order.clone());
// Once order is created, the assigned relayers's order capacity should reduce by one.
// Thus, the whole market needs to re-sort to generate new assigned relayers set.
let _ = Pallet::<T, I>::update_market(|| Ok(()), None);

let ids: Vec<T::AccountId> = assigned_relayers.iter().map(|r| r.id.clone()).collect();
Pallet::<T, I>::deposit_event(Event::OrderCreated(
Expand Down Expand Up @@ -76,11 +72,6 @@ impl<T: Config<I>, I: 'static> OnDeliveryConfirmed for FeeMarketMessageConfirmed
Some(order) => order.set_confirm_time(Some(now)),
None => {},
});

// Once order is confirmed, the assigned relayers's order capacity should
// increase by one. Thus, the whole market needs to re-sort to generate new
// assigned relayers set.
let _ = Pallet::<T, I>::update_market(|| Ok(()), None);
}
}
}
Expand Down
Loading

0 comments on commit 78a6bbc

Please sign in to comment.