-
Notifications
You must be signed in to change notification settings - Fork 2
Bug add days #22
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
base: develop
Are you sure you want to change the base?
Bug add days #22
Conversation
| @@ -0,0 +1,3188 @@ | |||
| // SPDX-License-Identifier: MIT | |||
|
|
|||
| pragma solidity ^0.6.0; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update flat file
| address oracle, | ||
| bool allowed, | ||
| bool exists); | ||
| event RequestActivityDistanceFulfilled(bytes32 indexed requestId, uint256 indexed distance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the event our app is waiting on? If so, should we include the committer's address as well?
contracts/SinglePlayerCommit.sol
Outdated
| /// @param _activityKey Keccak256 hashed, encoded name of activity | ||
| /// @param _goalValue Distance of activity as goal | ||
| /// @param _startTime Starttime of commitment, also used for endTime | ||
| /// @param _daysToStart Starttime of commitment, also used for endTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should generalize this to _timeToStart for greater precision. For example, we should be able to handle scenarios when a user wants to start in a few hours, or some number of hours and minutes.
Also, lets update the comment to reflect the new param.
contracts/SinglePlayerCommit.sol
Outdated
| userId: _userId, | ||
| exists: true | ||
| }); | ||
| uint256 startTime = _daysToStart > 0 ? addDays(_daysToStart, block.timestamp): block.timestamp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly here, I think we may need to user something other than the addDays function, e.g. if the offset is in hours or fractions of days.
contracts/SinglePlayerCommit.sol
Outdated
| _startTime, | ||
| endTime, | ||
| _stake); | ||
| emit NewCommitment(msg.sender, activities[_activityKey].name, _goalValue, _daysToStart, endTime, _stake); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's include startTime instead of _daysToStart in the event
contracts/SinglePlayerCommit.sol
Outdated
| /// @param _activityKey Keccak256 hashed, encoded name of activity | ||
| /// @param _goalValue Distance of activity as goal | ||
| /// @param _startTime Starttime of commitment, also used for endTime | ||
| /// @param _daysToStart Starttime of commitment, also used for endTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same change here to _timeToStart
contracts/SinglePlayerCommit.sol
Outdated
| _userId | ||
| ), "SPC::depositAndCommit - commitment creation failed"); | ||
| require( | ||
| makeCommitment(_activityKey, _goalValue, _daysToStart, _amountOfDays, _stake, _userId), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
closes #6
on #6:
Discord: "If I understand the case correctly, we could check on the timestamp of the previous block (as a threshold for 'the past'), but that is not something that could be done without querying the chain. My proposal would be to drop this and fix it in the front-end. So a CommitPool application specific requirement instead of a contract requirement. "