Skip to content

Commit

Permalink
minimum signature time not checked, more params validation in ESOP
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Rudolf committed May 1, 2017
1 parent 41560b0 commit d279b97
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions contracts/ESOP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,19 @@ contract ESOP is ESOPTypes, CodeUpdateable, TimeSource {
}
}

function openESOP(uint32 ptotalPoolOptions, bytes pESOPLegalWrapperIPFSHash)
function openESOP(uint32 pTotalPoolOptions, bytes pESOPLegalWrapperIPFSHash)
external
onlyCompany
onlyESOPNew
isCurrentCode
returns (ReturnCodes)
{
// options are stored in unit32
if (ptotalPoolOptions > 1100000) {
if (pTotalPoolOptions > 1100000 || pTotalPoolOptions < 10000) {
return _logerror(ReturnCodes.InvalidParameters);
}

totalPoolOptions = ptotalPoolOptions;
totalPoolOptions = pTotalPoolOptions;
remainingPoolOptions = totalPoolOptions;
ESOPLegalWrapperIPFSHash = pESOPLegalWrapperIPFSHash;

Expand Down Expand Up @@ -189,7 +189,7 @@ contract ESOP is ESOPTypes, CodeUpdateable, TimeSource {
removeEmployeesWithExpiredSignaturesAndReturnFadeout();
}
uint poolOptions = optionsCalculator.calcNewEmployeePoolOptions(remainingPoolOptions);
if (poolOptions > 0xFFFFFFFF || poolOptions == 0)
if (poolOptions > 0xFFFFFFFF)
throw;
Employee memory emp = Employee({
issueDate: issueDate, timeToSign: timeToSign, terminatedAt: 0, fadeoutStarts: 0, poolOptions: uint32(poolOptions),
Expand Down Expand Up @@ -217,6 +217,9 @@ contract ESOP is ESOPTypes, CodeUpdateable, TimeSource {
if (employees.hasEmployee(e)) {
return _logerror(ReturnCodes.InvalidEmployeeState);
}
if (timeToSign < currentTime() + MINIMUM_MANUAL_SIGN_PERIOD) {
return _logerror(ReturnCodes.TooLate);
}
Employee memory emp = Employee({
issueDate: issueDate, timeToSign: timeToSign, terminatedAt: 0, fadeoutStarts: 0, poolOptions: 0,
extraOptions: extraOptions, suspendedAt: 0, state: EmployeeState.WaitingForSignature, idx: 0
Expand Down

0 comments on commit d279b97

Please sign in to comment.