Linear Vesting in Solidity

Linear vesting is a great method for initial capital raising, as funds are not immediately released but linearly unlocked over a determined time-frame. This will prevent large market sells and will increase fairness.

Here's how a simple calculation for a linear vesting contract could look like:

This function simply calculates how much of your initial investment is claimable, depending on the vestingStart and the current block.timestamp.

If you incorporate this calculation into a claim function, you need to ensure that the already claimed value is deducted. This will prevent excess claiming.