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

Employee vesting #10

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Employee vesting #10

wants to merge 10 commits into from

Conversation

HMogg
Copy link

@HMogg HMogg commented Apr 12, 2021

Motivation

Added features for optimising the way in which employee vesting is handled. This includes only the DAO being able to cancel employee vests, adding functionality for multiple employee vesting schedules within a single transaction.

Changes

-Added capability for adding multiple employee vesting schedules in one transaction
-Added onlyDAO modifier
-Added setDAOAddress for changing the dao address
-Changed cancel vesting function to only be callable by DAO address

@raymogg raymogg requested review from raymogg and sporejack April 12, 2021 22:38
Copy link

@sporejack sporejack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks nice and clean - just a few things to consider.

contracts/vesting/EmployeeVesting.sol Show resolved Hide resolved
contracts/vesting/EmployeeVesting.sol Show resolved Hide resolved
contracts/vesting/EmployeeVesting.sol Show resolved Hide resolved
contracts/vesting/EmployeeVesting.sol Show resolved Hide resolved
* @param amount the total outstanding amount to be claimed for this vesting schedule.
* @param currentTime the current timestamp.
* @param startTime the timestamp this vesting schedule started.
* @param endTime the timestamp this vesting schedule ends.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing @return field in this NatSpec comment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would arguably be what @notice is describing, but I agree that it should be @return instead.

contracts/vesting/EmployeeVesting.sol Show resolved Hide resolved
contracts/vesting/EmployeeVesting.sol Show resolved Hide resolved
Copy link

@sporejack sporejack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@CalabashSquash CalabashSquash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍅

@@ -2,3 +2,4 @@ node_modules/
package-lock.json
yarn.lock

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once again, with modern package managers, lockfiles should be committed to source control. Here are some resources elaborating on this topic:

assert.equal(claimed[1].toString(), await web3.utils.toWei('50').toString())
})

it('With no cliff', async () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either the message is wrong or this should be a context?

})
})
})
describe('cancel', () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for onlyOwner is warranted here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sporejack what do you mean by this comment? A check for onlyOwner and onlyDAO exists for this test?

Comment on lines 32 to 40
context('When not enough tokens are held', () => {
it('allows vesting to be set', async () => {
await tcr.transfer(vesting.address, web3.utils.toWei('51'))
await vesting.setVestingSchedule(accounts[1], web3.utils.toWei('50'), true, 26, 156, now);
let userVesting = await vesting.getVesting(accounts[1], 0)
assert.equal(userVesting[0].toString(), await web3.utils.toWei('50'))
assert.equal(userVesting[1].toString(), await web3.utils.toWei('0'))
})
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a nitpick, but this test claims to test When not enough tokens are held, but there are 51 tokens held (greater than the amount vested, which is 50).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I meant to change this to be the other way around (I added 1 extra token instead of taking away 1).

Copy link
Collaborator

@CalabashSquash CalabashSquash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🇸🇹

@sporejack sporejack self-requested a review June 15, 2021 03:11
Copy link

@sporejack sporejack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushing this through

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants