@@ -34,6 +34,7 @@ contract SinglePlayerCommit is Ownable {
3434 uint256 stake; // amount of token staked, scaled by token decimals
3535 bool exists; // flag to help check if commitment exists
3636 uint256 reportedValue; // as reported by oracle
37+ bool timed; //if true, take time from API. if false, use default (distance)
3738 bool met; // whether the commitment has been met
3839 }
3940
@@ -44,6 +45,7 @@ contract SinglePlayerCommit is Ownable {
4445 address committer ,
4546 string activityName ,
4647 uint256 goal ,
48+ bool timed ,
4749 uint256 startTime ,
4850 uint256 endTime ,
4951 uint256 stake
@@ -92,12 +94,13 @@ contract SinglePlayerCommit is Ownable {
9294 function depositAndCommit (
9395 bytes32 _activityKey ,
9496 uint256 _goal ,
97+ bool _timed ,
9598 uint256 _startTime ,
9699 uint256 _stake ,
97100 uint256 _depositAmount
98101 ) public returns (bool ) {
99102 require (deposit (_depositAmount), "SPC::depositAndCommit - deposit failed " );
100- require (makeCommitment (_activityKey, _goal, _startTime, _stake), "SPC::depositAndCommit - commitment failed " );
103+ require (makeCommitment (_activityKey, _goal, _timed, _startTime, _stake), "SPC::depositAndCommit - commitment failed " );
101104
102105 return true ;
103106 }
@@ -119,6 +122,7 @@ contract SinglePlayerCommit is Ownable {
119122 bytes32 _activityKey ,
120123 // uint256 _measureIndex, // index of the Activity.measures array
121124 uint256 _goal ,
125+ bool _timed ,
122126 uint256 _startTime ,
123127 uint256 _stake
124128 ) public returns (bool ) {
@@ -140,6 +144,7 @@ contract SinglePlayerCommit is Ownable {
140144 committer: msg .sender ,
141145 activityKey: _activityKey,
142146 goal: _goal,
147+ timed: _timed,
143148 startTime: _startTime,
144149 endTime: endTime,
145150 stake: _stake,
@@ -151,7 +156,7 @@ contract SinglePlayerCommit is Ownable {
151156 // ...and add it to storage
152157 commitments[msg .sender ] = commitment;
153158
154- emit NewCommitment (msg .sender , allowedActivities[_activityKey].name, _goal, _startTime, endTime, _stake);
159+ emit NewCommitment (msg .sender , allowedActivities[_activityKey].name, _goal, _timed, _startTime, endTime, _stake);
155160
156161 return true ;
157162 }
@@ -261,4 +266,4 @@ contract SinglePlayerCommit is Ownable {
261266
262267 return true ;
263268 }
264- }
269+ }
0 commit comments