Closed shingonu closed 6 years ago
false if endTime <= startTime
uint256
is safer than uint8
. periods.length is equal to uint8 numPeriods
. no overflow occurs.require(periods.length == numPeriods);
makes sure that finishing sale before initPeriods()
is invoked
startTime[i] < endTime[i]
condition check is required in thevalidPeriods
function. https://github.com/Onther-Tech/tokyo/blob/3c6f03243d5c8c4d28c730c40aaa365b42e793c0/packages/tokyo-reusable-crowdsale/audit/full-features/contracts/base/crowdsale/StagedCrowdsale.sol#L74 like this:i
) value is expected to be a small value,uint256
is safer thanuint8
in for loop. https://github.com/Onther-Tech/tokyo/blob/3c6f03243d5c8c4d28c730c40aaa365b42e793c0/packages/tokyo-reusable-crowdsale/audit/full-features/contracts/base/crowdsale/StagedCrowdsale.sol#L80this
require
statement does not seem necessary. This is because we already checked when we created theinitPeriods
function.if this
require
statement needs, it is need to check not onlyrequire(periods.length == numPeriods);
but also startTime, endTime condition. So I think It's better to deleterequire(periods.length == numPeriods);
, or to writerequire(validPeriods())
instead ofrequire(periods.length == numPeriods);
statement . https://github.com/Onther-Tech/tokyo/blob/3c6f03243d5c8c4d28c730c40aaa365b42e793c0/packages/tokyo-reusable-crowdsale/audit/full-features/contracts/base/crowdsale/StagedCrowdsale.sol#L110