Skip to content

Commit

Permalink
Validate expire datetime
Browse files Browse the repository at this point in the history
Fixed #10
  • Loading branch information
DenisCarriere committed May 12, 2019
1 parent e21ebdd commit 9e0787a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
Binary file modified escrow.wasm
Binary file not shown.
4 changes: 0 additions & 4 deletions include/escrow.hpp
Expand Up @@ -111,9 +111,5 @@ namespace bos {

// 6 months in seconds (Computatio: 6 months * average days per month * 24 hours * 60 minutes * 60 seconds)
constexpr static uint32_t SIX_MONTHS_IN_SECONDS = (uint32_t) (6 * (365.25 / 12) * 24 * 60 * 60);

// static inline time_point_sec current_time_point_sec() {
// return time_point_sec(current_time_point());
// }
};
};
7 changes: 3 additions & 4 deletions src/escrow.cpp
Expand Up @@ -43,10 +43,9 @@ ACTION escrow::init(name sender, name receiver, name approver, time_point_sec ex
check( is_account( approver ), "approver account does not exist");

// Validate expire time_point_sec
// TO-DO
// check(expires > current_time_point(), "expires must be a value in the future.");
// time_point_sec max_expires = current_time_point() + SIX_MONTHS_IN_SECONDS;
// check(expires <= max_expires, "expires must be within 6 months from now.");
check(expires > current_time_point(), "expires must be a value in the future.");
time_point_sec max_expires = current_time_point() + time_point_sec(SIX_MONTHS_IN_SECONDS);
check(expires <= max_expires, "expires must be within 6 months from now.");

// Ensure sender is BOS Executive
check(
Expand Down

0 comments on commit 9e0787a

Please sign in to comment.