Skip to main content

FuroVesting

FuroVesting is the base contract for vesting tokens; it is not called directly, but instead utilized via the router.

Important: Use the FuroVestingRouter to create vestings; do NOT create vestings directly.

The full contract can be found here.

Functions

setTokenURIFetcher

function setTokenURIFetcher(address _fetcher) external onlyOwner

Sets the TokenURI fetcher address to the one given. Can only be called by the owner of the contract.

Parameters

NameTypeDescription
_fetcheraddressaddress to set token URI fetcher to

tokenURI

function tokenURI(uint256 id)
public
view
override
returns (string memory)

View function that returns the token URI.

Parameters

NameTypeDescription
iduint256token ID to return the URI from

setBentoBoxApproval

function setBentoBoxApproval(
address user,
bool approved,
uint8 v,
bytes32 r,
bytes32 s
) external payable override

Approves this contract for BentoBox.

Parameters

NameTypeDescription
useraddressuser address to set as owner in BentoBox
approvedboolboolean if approved or not by BentoBox
vuint8recovery byte of the signature
rbytes32half of the ECDSA signature pair
sbytes32half of the ECDSA signature pair

createVesting

function createVesting(VestParams calldata vestParams)
external
payable
override
returns (
uint256 depositedShares,
uint256 vestId,
uint128 stepShares,
uint128 cliffShares
)

Creates a vesting.

Parameters

NameTypeDescription
vestParamsVestParamsinfo necessary to create a new vesting (start, cliff, steps, etc.)

Returns

NameTypeDescription
depositedSharesuint256amount of shares deposited
vestIduint256new vesting ID
stepSharesuint128amount of step shares
cliffSharesuint128amount of cliff shares

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 vesting.

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 vesting

_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