Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation of new commitment successfull with startdate in past #6

Open
bitbeckers opened this issue Sep 29, 2020 · 0 comments · May be fixed by #22
Open

Creation of new commitment successfull with startdate in past #6

bitbeckers opened this issue Sep 29, 2020 · 0 comments · May be fixed by #22

Comments

@bitbeckers
Copy link
Member

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
@bitbeckers bitbeckers linked a pull request Dec 24, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant