Skip to content

Conversation

@bitbeckers
Copy link
Member

@bitbeckers bitbeckers commented Dec 24, 2020

closes #6

  • amountOfDays as parameter
  • updated test and finalized multiple tests that were still skipped

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. "

@spengrah
Copy link
Member

@@ -0,0 +1,3188 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;
Copy link
Member Author

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);
Copy link
Member

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?

/// @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
Copy link
Member

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.

userId: _userId,
exists: true
});
uint256 startTime = _daysToStart > 0 ? addDays(_daysToStart, block.timestamp): block.timestamp;
Copy link
Member

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.

_startTime,
endTime,
_stake);
emit NewCommitment(msg.sender, activities[_activityKey].name, _goalValue, _daysToStart, endTime, _stake);
Copy link
Member

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

/// @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
Copy link
Member

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

_userId
), "SPC::depositAndCommit - commitment creation failed");
require(
makeCommitment(_activityKey, _goalValue, _daysToStart, _amountOfDays, _stake, _userId),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

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 this pull request may close these issues.

Creation of new commitment successfull with startdate in past

3 participants