SQD Token vesting
This issue outlines the key functionality and general design of the vesting contracts.
General Design
Each vesting beneficiary will have a contract deployed. The contract will have a linear vesting function with a cliff, parametrized by vesting start time and duration, cliff, and total amount. Total amount will be linearly vested from start time for duration of vesting, but the beneficiary will only be able to withdraw SQD starting from (start time + cliff) timestamp

Contracts will be deployed by the factory and hidden behind a proxy contract to make deployment cheaper.
VestingFactory
- create(beneficiary, amount, startTime, duration, cliff) onlyManager
Creates new vesting, transfers amount SQD from sender to the vesting and makes sender the vesting owner
- add/removeProtocol(protocol) onlyManager whitelists protocols
- [optional] allow/disallowMethod(protocol, signature) onlyManager whitelists methods for the protocol
Vesting
-
unlocked() returns amount that can be withdrawn
-
locked() returns amount yet to be unlocked (including staked funds),
unlocked+locked+staked = totalAmount
-
wihthdraw() onlyBeneficiary transfers all unlocked SQD to the beneficiary
-
[unnecessary?] withdraw(amount) onlyBeneficiary transfers amount SQD to the beneficiary
-
approve(protocol, amount) onlyBeneficiary approves amount tokens for the whitelisted protocol
-
call(protocol, calldata) onlyBeneficiary call allowed method on the protocol
-
cancel() onlyOwner cancel vesting (maybe we want to add time restriction??)
Also necessary:
Some tool (frontend, probably) to see unlock curve, withdraw tokens, register workers, stake
SQD Token vesting
This issue outlines the key functionality and general design of the vesting contracts.
General Design
Each vesting beneficiary will have a contract deployed. The contract will have a linear vesting function with a cliff, parametrized by vesting start time and duration, cliff, and total amount. Total amount will be linearly vested from start time for duration of vesting, but the beneficiary will only be able to withdraw SQD starting from (start time + cliff) timestamp

Contracts will be deployed by the factory and hidden behind a proxy contract to make deployment cheaper.
VestingFactory
Creates new vesting, transfers amount SQD from sender to the vesting and makes sender the vesting owner
Vesting
unlocked() returns amount that can be withdrawn
locked() returns amount yet to be unlocked (including staked funds),
unlocked+locked+staked = totalAmount
wihthdraw() onlyBeneficiary transfers all unlocked SQD to the beneficiary
[unnecessary?] withdraw(amount) onlyBeneficiary transfers amount SQD to the beneficiary
approve(protocol, amount) onlyBeneficiary approves amount tokens for the whitelisted protocol
call(protocol, calldata) onlyBeneficiary call allowed method on the protocol
cancel() onlyOwner cancel vesting (maybe we want to add time restriction??)
Also necessary:
Some tool (frontend, probably) to see unlock curve, withdraw tokens, register workers, stake