Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payroll: Ceil last payroll date calculation #776

Merged
merged 13 commits into from Apr 16, 2019
Merged
Changes from 5 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -88,12 +88,14 @@ contract('Payroll employees addition', ([owner, employee, anotherEmployee, anyon
assert.equal(event.startDate.toString(), (await currentTimestamp()).toString(), 'employee start date does not match')
assert.equal(event.initialDenominationSalary.toString(), anotherSalary.toString(), 'employee salary does not match')

const [address, employeeSalary, accruedValue, lastPayroll, endDate] = await payroll.getEmployee(anotherEmployeeId)
assert.equal(address, anotherEmployee, 'Employee account does not match')
assert.equal(accruedValue, 0, 'Employee accrued value does not match')
assert.equal(employeeSalary.toString(), anotherSalary.toString(), 'Employee salary does not match')
assert.equal(lastPayroll.toString(), (await currentTimestamp()).toString(), 'last payroll should match')
assert.equal(endDate.toString(), maxUint64(), 'last payroll should match')
const [address, employeeSalary, bonus, accruedValue, accruedSalary, lastPayroll, endDate] = await payroll.getEmployee(anotherEmployeeId)
assert.equal(address, anotherEmployee, 'employee account does not match')
assert.equal(bonus.toString(), 0, 'employee bonus does not match')
assert.equal(accruedValue, 0, 'employee accrued value does not match')
assert.equal(accruedSalary, 0, 'employee accrued salary does not match')
assert.equal(employeeSalary.toString(), anotherSalary.toString(), 'employee salary does not match')
assert.equal(lastPayroll.toString(), (await currentTimestamp()).toString(), 'employee last payroll does not match')
assert.equal(endDate.toString(), maxUint64(), 'employee end date does not match')
})
})

@@ -194,12 +196,14 @@ contract('Payroll employees addition', ([owner, employee, anotherEmployee, anyon
assert.equal(event.startDate.toString(), startDate, 'employee start date does not match')
assert.equal(event.initialDenominationSalary.toString(), anotherSalary.toString(), 'employee salary does not match')

const [address, employeeSalary, accruedValue, lastPayroll, endDate] = await payroll.getEmployee(anotherEmployeeId)
assert.equal(address, anotherEmployee, 'Employee account does not match')
assert.equal(accruedValue, 0, 'Employee accrued value does not match')
assert.equal(employeeSalary.toString(), anotherSalary.toString(), 'Employee salary does not match')
assert.equal(lastPayroll.toString(), startDate.toString(), 'last payroll should match')
assert.equal(endDate.toString(), maxUint64(), 'last payroll should match')
const [address, employeeSalary, bonus, accruedValue, accruedSalary, lastPayroll, endDate] = await payroll.getEmployee(anotherEmployeeId)
assert.equal(address, anotherEmployee, 'employee address does not match')
assert.equal(bonus.toString(), 0, 'employee bonus does not match')
assert.equal(accruedValue, 0, 'employee accrued value does not match')
assert.equal(accruedSalary, 0, 'employee accrued salary does not match')
assert.equal(employeeSalary.toString(), anotherSalary.toString(), 'employee salary does not match')
assert.equal(lastPayroll.toString(), startDate.toString(), 'employee last payroll does not match')
assert.equal(endDate.toString(), maxUint64(), 'employee end date does not match')
})
})

@@ -14,6 +14,7 @@ contract('Payroll allowed tokens,', ([owner, employee, anotherEmployee, anyone])
const RATE_EXPIRATION_TIME = TWO_MONTHS

const TOKEN_DECIMALS = 18
const PAYROLL_PAYMENT_TYPE = 0

before('setup base apps and tokens', async () => {
({ dao, finance, vault, priceFeed, payrollBase } = await deployContracts(owner))
@@ -101,7 +102,7 @@ contract('Payroll allowed tokens,', ([owner, employee, anotherEmployee, anyone])
const allocationTx = await payroll.determineAllocation(tokenAddresses, allocations, { from: employee })
assert.isBelow(allocationTx.receipt.cumulativeGasUsed, MAX_GAS_USED, 'Too much gas consumed for allocation')

const paydayTx = await payroll.payday({ from: employee })
const paydayTx = await payroll.payday(PAYROLL_PAYMENT_TYPE, 0, { from: employee })
assert.isBelow(paydayTx.receipt.cumulativeGasUsed, MAX_GAS_USED, 'Too much gas consumed for payday')
})
})
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.