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

Commit

Permalink
Redesign fee market payment (#169)
Browse files Browse the repository at this point in the history
* Add basic solution

* Refactor Slash Report

* Refactor Slash Report 2

* Add other changes

* Add tests

* Self review

* Rename to `message_and_confirm_reward`

* Rename to `previous_relayers`

* Rename to AssignedRelayer

* Add more comments

* Add more comments

* Add new reward implementation

* Rename and clean the code, needs more test

* Add more docs here

* Prepare for tests

* Fix broken tests

* Refactor

* Rename

* Remove RewardBook

* Self review

* Save one storage

* Try fix ci
  • Loading branch information
boundless-forest authored and jiguantong committed Sep 29, 2022
1 parent 5cb346f commit c0c0fc9
Show file tree
Hide file tree
Showing 3 changed files with 393 additions and 191 deletions.
13 changes: 2 additions & 11 deletions modules/fee-market/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ pub mod pallet {
#[pallet::constant]
type MinimumRelayFee: Get<BalanceOf<Self, I>>;
/// The collateral relayer need to lock for each order.
///
/// This also represents the maximum slash value for a single delayed order.
/// Please note that if this value is set to zero the fee market will be suspended.
#[pallet::constant]
type CollateralPerOrder: Get<BalanceOf<Self, I>>;
/// The slot times set
Expand All @@ -80,7 +77,7 @@ pub mod pallet {

/// Reward parameters
#[pallet::constant]
type DutyRelayersRewardRatio: Get<Permill>;
type GuardRelayersRewardRatio: Get<Permill>;
#[pallet::constant]
type MessageRelayersRewardRatio: Get<Permill>;
#[pallet::constant]
Expand Down Expand Up @@ -506,13 +503,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
}

fn collateral_to_order_capacity(collateral: BalanceOf<T, I>) -> u32 {
let collateral_per_order = T::CollateralPerOrder::get();

if collateral_per_order.is_zero() {
0
} else {
(collateral / collateral_per_order).saturated_into::<u32>()
}
(collateral / T::CollateralPerOrder::get()).saturated_into::<u32>()
}
}

Expand Down
Loading

0 comments on commit c0c0fc9

Please sign in to comment.