Skip to main content

FuroVesting

FuroVesting is the contract for vesting tokens.

The full contract can be found here.

Functions

createVesting

function createVesting(
IERC20 token,
address recipient,
uint32 start,
uint32 cliffDuration,
uint32 stepDuration,
uint32 steps,
uint128 cliffAmount,
uint128 stepAmount,
bool fromBentoBox
)
external
payable
override
returns (uint256 depositedShares, uint256 vestId)

Creates a vesting schedule for the token stream.

Parameters

NameTypeDescription
tokenIERC20the token to vest
recipientaddressaddress of recipient
startuint32when vesting starts
cliffDurationuint32length of vesting cliff
stepDurationuint32length of steps
stepsuint32amount of steps
cliffAmountuint128amount to set for cliff
stepAmountuint128amount to set for each step
fromBentoBoxboolboolean for if coming from BentoBox or not

Returns

NameTypeDescription
depositedSharesuint256amount of shares deposited
vestIduint256new vesting ID

withdraw

 function withdraw(
uint256 vestId,
bytes calldata taskData,
bool toBentoBox
) external override

Withdraws from the vesting.

Parameters

NameTypeDescription
vestIduint256the ID of the vestment to withdraw from
taskDatabytesdata tasks
toBentoBoxboolboolean for if coming from BentoBox or not

stopVesting

function stopVesting(uint256 vestId, bool toBentoBox) external override

Stops a vesting.

Parameters

NameTypeDescription
vestIduint256vesting ID to stop
toBentoBoxboolboolean for if coming from BentoBox or not

vestBalance

function vestBalance(uint256 vestId)
external
view
override
returns (uint256)

View function that returns the current balance of the vesting.

Parameters

NameTypeDescription
vestIduint256vesting ID to check balance of

_balanceOf

function _balanceOf(Vest memory vest)
internal
view
returns (uint256 claimable)

Internal function that returns the amount of claimable tokens from a vesting, given the specific vestment object.

Parameters

NameTypeDescription
vestVestvesting object to check balance of

Returns

NameTypeDescription
claimableuint256amount of claimable tokens from vesting

updateOwner

function updateOwner(uint256 vestId, address newOwner) external override

Sets the new owner of a vesting. Must be current owner to set.

Parameters

NameTypeDescription
vestIduint256vesting ID to change owner of
newOwneraddressaddress of new owner to set

_depositToken

function _depositToken(
address token,
address from,
address to,
uint256 amount,
bool fromBentoBox
) internal returns (uint256 depositedShares)

Internal function that deposits a token into a stream.

Parameters

NameTypeDescription
tokenaddressaddress of token to deposit
fromaddressaddress of user depositing tokens
toaddressaddress of token recipient
amountuint256amount of tokens to deposit
fromBentoBoxboolboolean of whether update is coming from BentoBox or not

Returns

NameTypeDescription
depositedSharesuint256amount of shares deposited in stream

_transferToken

function _transferToken(
address token,
address from,
address to,
uint256 amount,
bool toBentoBox
) internal

Internal function used by others in the contract, it safely transfers tokens.

Parameters

NameTypeDescription
tokenaddressaddress of token to send
fromaddressaddress of user sending the tokens
toaddressaddress of token recipient
amountuint256amount of tokens to send
toBentoBoxboolboolean of whether the transfer is going to BentoBox or not