Skip to content

Commit

Permalink
Merge pull request #11 from interlay/greg/feat/sla-event-delta
Browse files Browse the repository at this point in the history
feat: add delta_sla to update sla events
  • Loading branch information
gregdhill authored Feb 26, 2021
2 parents ecc276d + 514cb9f commit 8b396ba
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions crates/sla/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ decl_event!(
AccountId = <T as frame_system::Config>::AccountId,
SignedFixedPoint = SignedFixedPoint<T>,
{
UpdateVaultSLA(AccountId, SignedFixedPoint),
UpdateRelayerSLA(AccountId, SignedFixedPoint),
// [vault_id, bounded_new_sla, delta_sla]
UpdateVaultSLA(AccountId, SignedFixedPoint, SignedFixedPoint),
// [relayer_id, new_sla, delta_sla]
UpdateRelayerSLA(AccountId, SignedFixedPoint, SignedFixedPoint),
}
);

Expand Down Expand Up @@ -139,7 +141,11 @@ impl<T: Config> Module<T> {
let bounded_new_sla = Self::_limit(T::SignedFixedPoint::zero(), new_sla, max_sla);

<VaultSla<T>>::insert(vault_id.clone(), bounded_new_sla);
Self::deposit_event(<Event<T>>::UpdateVaultSLA(vault_id, bounded_new_sla));
Self::deposit_event(<Event<T>>::UpdateVaultSLA(
vault_id,
bounded_new_sla,
delta_sla,
));

Ok(())
}
Expand Down Expand Up @@ -183,7 +189,7 @@ impl<T: Config> Module<T> {

<TotalRelayerScore<T>>::set(new_total);
<RelayerSla<T>>::insert(relayer_id.clone(), new_sla);
Self::deposit_event(<Event<T>>::UpdateRelayerSLA(relayer_id, new_sla));
Self::deposit_event(<Event<T>>::UpdateRelayerSLA(relayer_id, new_sla, delta_sla));
}

Ok(())
Expand Down

0 comments on commit 8b396ba

Please sign in to comment.