Skip to content

Commit

Permalink
Fixed darwinia-network#169, checking the timestamp unit when redeem d…
Browse files Browse the repository at this point in the history
…eposits
  • Loading branch information
hackfisher authored and yanganto committed Feb 27, 2020
1 parent 5b85020 commit ad17532
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions frame/chainrelay/eth/backing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ decl_module! {

<MomentT<T>>::saturated_from(Moment::try_from(month)? as _)
};
// TODO: Check the time unit in seconds or milliseconds
// https://github.com/evolutionlandorg/bank/blob/master/contracts/GringottsBankV2.sol#L178
// The start_at here is in seconds, will be converted to milliseconds later in on_deposit_redeem
let start_at = {
let start_at = result
.params[3]
Expand All @@ -238,7 +239,8 @@ decl_module! {
<MomentT<T>>::saturated_from(Moment::try_from(start_at)? as _)
};
let redeemed_ring = {
// TODO: div 10**18 and mul 10**9
// The decimal in Ethereum is 10**18, and the decimal in Darwinia is 10**9,
// div 10**18 and mul 10**9
let amount = result.params[5]
.value
.clone()
Expand Down
2 changes: 1 addition & 1 deletion frame/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2378,7 +2378,7 @@ impl<T: Trait> OnDepositRedeem<T::AccountId> for Module<T> {
let controller = Self::bonded(&stash).ok_or(<Error<T>>::NotStash)?;
let ledger = Self::ledger(&controller).ok_or(<Error<T>>::NotController)?;

// TODO: Issue #169, checking the timestamp unit difference between Ethereum and Darwinia
// The timestamp unit is different between Ethereum and Darwinia, converting from seconds to milliseconds
let start_time = start_time * 1000;
let promise_month = months.min(36);

Expand Down

0 comments on commit ad17532

Please sign in to comment.