Skip to content

Creation of new commitment successfull with startdate in past #6

Open
@bitbeckers

Description

@bitbeckers

Issue
In the contract we have multiple require checks to validate contract calls before execution. One of those is checking whether the Commitment that is created does not have a startTime that is in the past

Example
line 180 SinglePlayerCommit.sol
require(_startTime > block.timestamp, "SPC::makeCommitment - commitment cannot start in the past");

line 145..149 SinglePlayerCommit.user.sol (test)

_startTime = new Date('1 Jan 2016 12:34:56 GMT').valueOf();

// await expect(
//   contractWithUser.makeCommitment(_activity, _measureIndex, _goal, _startTime, _amountToStake, _overrides),
// ).to.be.revertedWith("SPC::makeCommitment - commitment cannot start in the past");

Reference
https://solidity.readthedocs.io/en/v0.6.10/units-and-global-variables.html?highlight=time#time-units

Expected outcome

  1. When making a contract call with a startTime in the past, the call is reverted with the error message declared in the contract.
  2. there might be some delay, so maybe for now starttime can always be current blocktime?
  3. test uncommented and passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions