8
8
* Allows users to vote yes/no on whether a price is accurate
9
9
10
10
*/
11
- pragma solidity >= 0.4.24 ;
11
+ pragma solidity ^ 0.5.0 ;
12
12
13
13
pragma experimental ABIEncoderV2;
14
14
@@ -72,7 +72,7 @@ library Poll {
72
72
}
73
73
}
74
74
75
- function _addProposal (Data storage self , string ipfsHash ) internal {
75
+ function _addProposal (Data storage self , string memory ipfsHash ) internal {
76
76
uint idx = self.proposals.length ++ ;
77
77
self.proposals[idx].ipfsHash = ipfsHash;
78
78
}
@@ -107,7 +107,7 @@ library VotePeriod {
107
107
mapping (string => bool ) ipfsHashSet;
108
108
}
109
109
110
- function _proposeFeed (Data storage self , string ipfsHash ) internal {
110
+ function _proposeFeed (Data storage self , string memory ipfsHash ) internal {
111
111
require (! self.ipfsHashSet[ipfsHash]);
112
112
self.ipfsHashSet[ipfsHash] = true ;
113
113
self.runoffPoll._addProposal (ipfsHash);
@@ -210,7 +210,7 @@ contract VoteCoin is ERC20, VoteInterface, OracleInterface, Testable {
210
210
211
211
PeriodTiming[5 ] private periodTimings;
212
212
213
- constructor (string _product , uint _priceInterval , bool isTest ) public Testable (isTest) {
213
+ constructor (string memory _product , uint _priceInterval , bool isTest ) public Testable (isTest) {
214
214
_mint (msg .sender , 10000 );
215
215
product = _product;
216
216
priceInterval = _priceInterval;
@@ -269,20 +269,20 @@ contract VoteCoin is ERC20, VoteInterface, OracleInterface, Testable {
269
269
_getCurrentVotePeriod ()._revealVote (voteOption, salt, balanceOf (msg .sender ), period);
270
270
}
271
271
272
- function proposeFeed (string ipfsHash ) public {
272
+ function proposeFeed (string memory ipfsHash ) public {
273
273
checkTimeAndUpdateState ();
274
274
require (period == VotePeriod.PeriodType.Commit || period == VotePeriod.PeriodType.Reveal);
275
275
276
276
_getCurrentVotePeriod ()._proposeFeed (ipfsHash);
277
277
}
278
278
279
- function addUnverifiedPrice (PriceTime.Data priceTime ) public {
279
+ function addUnverifiedPrice (PriceTime.Data memory priceTime ) public {
280
280
PriceTime.Data[] memory priceTimes = new PriceTime.Data [](1 );
281
281
priceTimes[0 ] = priceTime;
282
282
addUnverifiedPrices (priceTimes);
283
283
}
284
284
285
- function getProposals () public view returns (Proposal.Data[] proposals ) {
285
+ function getProposals () public view returns (Proposal.Data[] memory proposals ) {
286
286
uint time = getCurrentTime ();
287
287
uint computedStartTime = _getStartOfPeriod (time);
288
288
@@ -307,23 +307,23 @@ contract VoteCoin is ERC20, VoteInterface, OracleInterface, Testable {
307
307
}
308
308
}
309
309
310
- function getCurrentPeriodType () public view returns (string periodType ) {
310
+ function getCurrentPeriodType () public view returns (string memory periodType ) {
311
311
uint currentTime = getCurrentTime ();
312
312
return _getStringPeriodType (_getPeriodType (_getStartOfPeriod (currentTime), currentTime));
313
313
}
314
314
315
- function getProduct () public view returns (string _product ) {
315
+ function getProduct () public view returns (string memory _product ) {
316
316
return product;
317
317
}
318
318
319
- function getDefaultProposalPrices () public view returns (PriceTime.Data[] prices ) {
319
+ function getDefaultProposalPrices () public view returns (PriceTime.Data[] memory prices ) {
320
320
// TODO(mrice32): we may want to subtract some time offset to ensure all unverifiedPrices being voted on are
321
321
// in before the voting period starts.
322
322
// Note: this will fail if the entire voting period of prices previous do not exist.
323
323
VotePeriod.Data storage votePeriod = _getCurrentVotePeriod ();
324
324
(uint startTime , uint endTime ) = votePeriod._getPricePeriod (totalVotingDuration);
325
325
if (unverifiedPrices.length == 0 || startTime < unverifiedPrices[0 ].time) {
326
- return ;
326
+ return prices ;
327
327
}
328
328
uint startIndex = unverifiedPrices._getIndex (startTime, priceInterval);
329
329
@@ -469,7 +469,11 @@ contract VoteCoin is ERC20, VoteInterface, OracleInterface, Testable {
469
469
return timestamp.sub (epochOffset).div (totalVotingDuration).mul (totalVotingDuration).add (epochOffset);
470
470
}
471
471
472
- function _getStringPeriodType (VotePeriod.PeriodType periodType ) private pure returns (string stringPeriodType ) {
472
+ function _getStringPeriodType (VotePeriod.PeriodType periodType )
473
+ private
474
+ pure
475
+ returns (string memory stringPeriodType )
476
+ {
473
477
if (periodType == VotePeriod.PeriodType.Commit) {
474
478
return "commit " ;
475
479
} else if (periodType == VotePeriod.PeriodType.Reveal) {
@@ -488,7 +492,7 @@ contract VoteCoin is ERC20, VoteInterface, OracleInterface, Testable {
488
492
function _initPeriodTiming (uint startOffset , uint duration , VotePeriod.PeriodType periodType )
489
493
private
490
494
view
491
- returns (PeriodTiming periodTiming , uint nextStartOffset )
495
+ returns (PeriodTiming memory periodTiming , uint nextStartOffset )
492
496
{
493
497
periodTiming.startOffset = startOffset;
494
498
periodTiming.endOffset = startOffset.add (duration);
0 commit comments