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

Vesting Escrow Wallet #316

Conversation

shanefontaine
Copy link

Please check if the PR fulfills these requirements

  • The commit message follows our Submission guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce?

Add VestingEscrowWallet.sol for Gitcoin Bounty #269.

What is the current behavior?

Everything functions as described in #269.

What is the new behavior?

Everything functions as described in #269.

Does this PR introduce a breaking change?

No

Any Other information:

…okens/numClaimedVestedTokens/numUnclaimedVestedTokens
@shanefontaine shanefontaine changed the title Development 1.5.0 Vesting Escrow Wallet Oct 5, 2018
contracts/modules/Wallet/VestingEscrowWallet.sol Outdated Show resolved Hide resolved
contracts/modules/Wallet/VestingEscrowWallet.sol Outdated Show resolved Hide resolved
contracts/modules/Wallet/VestingEscrowWallet.sol Outdated Show resolved Hide resolved
contracts/modules/Wallet/VestingEscrowWallet.sol Outdated Show resolved Hide resolved
contracts/modules/Wallet/VestingEscrowWallet.sol Outdated Show resolved Hide resolved
* @notice Type of the Module factory
*/
function getType() public view returns(uint8) {
return 5;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please take the latest code pull from the development-1.5.0 branch. this function is now changed to getTypes()

Copy link
Author

Choose a reason for hiding this comment

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

Resolved with this commit.

Copy link
Contributor

Choose a reason for hiding this comment

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

It still not compatible with the latest commit it should look as -

   function getTypes() public view returns(uint8[]) {
           uint8[] memory res = new uint8[](1);
            res[0] = 6;
             return res;
       }

I am afraid you need to change the type make it 6 as we are using 5 for the Burn type module

test/u_vesting_escrow_wallet.js Show resolved Hide resolved
Copy link
Contributor

@satyamakgec satyamakgec left a comment

Choose a reason for hiding this comment

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

@shanefontaine I think below requirement is missing

As an issuer I want to be able to view all my vesting schedules and it's progressing so I can have a quick overview of how much tokens each of my employees/affiliates have


vestingTemplates[templateCount] = VestingTemplate(_totalAllocation, _vestingDuration, _vestingFrequency);

templateCount = templateCount == 0 ? 0 : templateCount +1;
Copy link
Contributor

Choose a reason for hiding this comment

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

This line should be written after the emission of event otherwise you will emit the wrong templateCount. And please change the name of the variable make it tempalteIndex.

uint256[] _vestingFrequency
)
public
onlyOwner
Copy link
Contributor

Choose a reason for hiding this comment

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

No need of onlyOwner modifier if we are using the withPerm() modifier.

contract VestingEscrowWallet is IWallet {
using SafeMath for uint;

bytes32 public constant ISSUER = "ISSUER";
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we need to permission type to be a ISSUER if the only Issuer is going to call those functions then we can use onlyOwner modifier everywhere. I suggest change the Permission type and give it a different name as WALLET_ADMIN or VESTING_ADMIN or ADMIN etc.

uint256 _startDate
)
public
onlyOwner
Copy link
Contributor

Choose a reason for hiding this comment

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

same remove the onlyOwner

* @param _vestingScheduleIndex Index of the vesting schedule for the target
* @param _revokeVestingSchedule True if the issuer is reclaiming the tokens out of the contract
*/
function cancelVestingSchedule(address _target, uint256 _vestingScheduleIndex, bool _revokeVestingSchedule)
Copy link
Contributor

Choose a reason for hiding this comment

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

rename the _target variable to _vestee. It will be more clear. Please do it in the whole contract


require(_vestingSchedule.vestingId != 0, "Schedule not initialized");

uint256 _currentTranche = _calculateCurrentTranche(_vestingSchedule.startDate, _vestingSchedule.vestingDuration);
Copy link
Contributor

Choose a reason for hiding this comment

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

if _currentTrnache value is 0 then the function should revert no need to process further.

uint256 _vestingDuration
)
internal
view
Copy link
Contributor

Choose a reason for hiding this comment

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

can use pure here

* @param _vestingScheduleIndex Index of the vesting schedule for the target
* @param _revokeVestingSchedule True if the issuer is reclaiming the tokens out of the contract
*/
function cancelVestingSchedule(address _target, uint256 _vestingScheduleIndex, bool _revokeVestingSchedule)
Copy link
Contributor

Choose a reason for hiding this comment

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

could you please change the name of the function instead of word cancel could you use some meaning full word that signifies the working of function.
ex- drop, remove etc

if (setupCost > 0)
require(polyToken.transferFrom(msg.sender, owner, setupCost), "Failed transferFrom because of sufficent Allowance is not provided");
address vestingEscrwoWallet = new VestingEscrowWallet(msg.sender, address(polyToken));
return vestingEscrwoWallet;
Copy link
Contributor

Choose a reason for hiding this comment

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

you are not emitting the event GenerateModuleFromFactory

* @notice Type of the Module factory
*/
function getType() public view returns(uint8) {
return 5;
Copy link
Contributor

Choose a reason for hiding this comment

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

It still not compatible with the latest commit it should look as -

   function getTypes() public view returns(uint8[]) {
           uint8[] memory res = new uint8[](1);
            res[0] = 6;
             return res;
       }

I am afraid you need to change the type make it 6 as we are using 5 for the Burn type module

@maxsam4
Copy link
Contributor

maxsam4 commented Nov 15, 2018

Closing due to inactivity.

@maxsam4 maxsam4 closed this Nov 15, 2018
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.

3 participants