Spool Tech Docs
Search
⌃K

VoSPOOL.sol

Spool DAO Voting Token Implementation
The voting SPOOL pseudo-ERC20 Implementation An untransferable token implementation meant to be used by the Spool DAO to mint the voting equivalent of the staked token.
Users voting power consists of instant and gradual (maturing) voting power. voSPOOL contract assumes voting power comes from vesting or staking SPOOL tokens. As SPOOL tokens have a maximum supply of 210,000,000 * 10 ** 18, we consider this limitation when storing data (e.g. storing amount divided by 10 ** 12) to save on gas. Instant voting power can be used in the full amount as soon as minted. Gradual voting power: Matures linearly over 156 weeks (3 years) up to the minted amount. If a user burns gradual voting power, all accumulated voting power is reset to zero. In case there is some amount left, it'll take another 3 years to achieve fully-matured power. Only gradual voting power is reset and not instant one. Gradual voting power updates at every new tranche, which lasts one week.
Contract consists of: - CONSTANTS - STATE VARIABLES - CONSTRUCTOR - IERC20 FUNCTIONS - INSTANT POWER FUNCTIONS - GRADUAL POWER FUNCTIONS - GRADUAL POWER: VIEW FUNCTIONS - GRADUAL POWER: MINT FUNCTIONS - GRADUAL POWER: BURN FUNCTIONS - GRADUAL POWER: UPDATE GLOBAL FUNCTIONS - GRADUAL POWER: UPDATE USER FUNCTIONS - GRADUAL POWER: GLOBAL HELPER FUNCTIONS - GRADUAL POWER: USER HELPER FUNCTIONS - GRADUAL POWER: HELPER FUNCTIONS - OWNER FUNCTIONS - RESTRICTION FUNCTIONS - MODIFIERS

Methods

FULL_POWER_TIME

function FULL_POWER_TIME() external view returns (uint256)
time until gradual power is fully-matured
full power time is 156 weeks (approximately 3 years)

Returns

Name
Type
Description
_0
uint256
undefined

FULL_POWER_TRANCHES_COUNT

function FULL_POWER_TRANCHES_COUNT() external view returns (uint256)
amount of tranches to mature to full power

Returns

Name
Type
Description
_0
uint256
undefined

TRANCHE_TIME

function TRANCHE_TIME() external view returns (uint256)
duration of one tranche

Returns

Name
Type
Description
_0
uint256
undefined

allowance

function allowance(address, address) external pure returns (uint256)
Execution of function is prohibited to disallow token movement

Parameters

Name
Type
Description
_0
address
undefined
_1
address
undefined

Returns

Name
Type
Description
_0
uint256
undefined

approve

function approve(address, uint256) external pure returns (bool)
Execution of function is prohibited to disallow token movement

Parameters

Name
Type
Description
_0
address
undefined
_1
uint256
undefined

Returns

Name
Type
Description
_0
bool
undefined

balanceOf

function balanceOf(address account) external view returns (uint256)
Returns current user total voting power

Parameters

Name
Type
Description
account
address
undefined

Returns

Name
Type
Description
_0
uint256
undefined

burn

function burn(address from, uint256 amount) external nonpayable
Burns the provided amount of instant power from the specified user.
only instant power is removed, gradual power stays the same Requirements: - the caller must be the instant minter - the user must posses at least the burning amount of instant voting power amount

Parameters

Name
Type
Description
from
address
burn from user
amount
uint256
burn amount

burnGradual

function burnGradual(address from, uint256 amount, bool burnAll) external nonpayable
Burns the provided amount of gradual power from the specified user.
User loses all matured power accumulated till now. Voting power starts maturing from the start if there is any amount left. Requirements: - the caller must be the gradual minter

Parameters

Name
Type
Description
from
address
burn from user
amount
uint256
burn amount
burnAll
bool
true to burn all user amount

decimals

function decimals() external view returns (uint8)
Token decimals

Returns

Name
Type
Description
_0
uint8
undefined

firstTrancheStartTime

function firstTrancheStartTime() external view returns (uint256)
tranche time for index 1

Returns

Name
Type
Description
_0
uint256
undefined

getCurrentTrancheIndex

function getCurrentTrancheIndex() external view returns (uint16)
Returns current active tranche index

Returns

Name
Type
Description
_0
uint16
trancheIndex current tranche index

getGlobalGradual

function getGlobalGradual() external view returns (struct GlobalGradual)
returns updated global gradual struct

Returns

Name
Type
Description
_0
GlobalGradual
global updated global gradual struct

getLastFinishedTrancheIndex

function getLastFinishedTrancheIndex() external view returns (uint16)
Returns last finished tranche index

Returns

Name
Type
Description
_0
uint16
trancheIndex last finished tranche index

getNextTrancheEndTime

function getNextTrancheEndTime() external view returns (uint256)
Returns next tranche end time

Returns

Name
Type
Description
_0
uint256
trancheEndTime end time for next tranche

getNotUpdatedGlobalGradual

function getNotUpdatedGlobalGradual() external view returns (struct GlobalGradual)
returns not updated global gradual struct

Returns

Name
Type
Description
_0
GlobalGradual
global updated global gradual struct

getNotUpdatedUserGradual

function getNotUpdatedUserGradual(address user) external view returns (struct UserGradual)
returns not updated user gradual struct

Parameters

Name
Type
Description
user
address
user address

Returns

Name
Type
Description
_0
UserGradual
_userGradual user updated gradual struct

getTotalGradualVotingPower

function getTotalGradualVotingPower() external view returns (uint256)
returns updated total gradual voting power (fully-matured and maturing)

Returns

Name
Type
Description
_0
uint256
totalGradualVotingPower total gradual voting power (fully-matured + maturing)

getTrancheEndTime

function getTrancheEndTime(uint256 trancheIndex) external view returns (uint256)
Returns tranche end time for tranche index

Parameters

Name
Type
Description
trancheIndex
uint256
tranche index

Returns

Name
Type
Description
_0
uint256
trancheEndTime end time for trancheIndex

getTrancheIndex

function getTrancheIndex(uint256 time) external view returns (uint256)
Returns tranche index based on time
time can be any time inside the tranche Requirements: - time must be equal to more than first tranche time

Parameters

Name
Type
Description
time
uint256
tranche time time to get the index for

Returns

Name
Type
Description
_0
uint256
trancheIndex tranche index at time

getUserGradual

function getUserGradual(address user) external view returns (struct UserGradual)
returns updated user gradual struct

Parameters

Name
Type
Description
user
address
user address

Returns

Name
Type
Description
_0
UserGradual
_userGradual user updated gradual struct

getUserGradualVotingPower

function getUserGradualVotingPower(address user) external view returns (uint256)
returns updated user gradual voting power (fully-matured and maturing)

Parameters

Name
Type
Description
user
address
address holding voting power

Returns

Name
Type
Description
_0
uint256
userGradualVotingPower user gradual voting power (fully-matured + maturing)

gradualMinters

function gradualMinters(address) external view returns (bool)
mapping holding gradual minting privileges for addresses

Parameters

Name
Type
Description
_0
address
undefined

Returns

Name
Type
Description
_0
bool
undefined

indexedGlobalTranches

function indexedGlobalTranches(uint256) external view returns (struct Tranche zero, struct Tranche one, struct Tranche two, struct Tranche three, struct Tranche four)
global tranches
mapping tranche index to a group of tranches (5 tranches per word)

Parameters

Name
Type
Description
_0
uint256
undefined

Returns

Name
Type
Description
zero
Tranche
undefined
one
Tranche
undefined
two
Tranche
undefined
three
Tranche
undefined
four
Tranche
undefined

mint

function mint(address to, uint256 amount) external nonpayable
Mints the provided amount as instant voting power. Requirements: - the caller must be the autorized

Parameters

Name
Type
Description
to
address
mint to user
amount
uint256
mint amount

mintGradual

function mintGradual(address to, uint256 amount) external nonpayable
Mints the provided amount of tokens to the specified user to gradually mature up to the amount.
Saves the amount to tranche user index, so the voting power starts maturing. Requirements: - the caller must be the autorized

Parameters

Name
Type
Description
to
address
gradual mint to user
amount
uint256
gradual mint amount

minters

function minters(address) external view returns (bool)
mapping holding instant minting privileges for addresses

Parameters

Name
Type
Description
_0
address
undefined

Returns

Name
Type
Description
_0
bool
undefined

name

function name() external view returns (string)
Token name full name

Returns

Name
Type
Description
_0
string
undefined

setGradualMinter

function setGradualMinter(address _gradualMinter, bool _set) external nonpayable
Sets or resets the gradual minter address Requirements: - the caller must be the owner of the contract - the minter must not be the zero address

Parameters

Name
Type
Description
_gradualMinter
address
address to set
_set
bool
true to set, false to reset

setMinter

function setMinter(address _minter, bool _set) external nonpayable
Sets or resets the instant minter address Requirements: - the caller must be the owner of the contract - the minter must not be the zero address

Parameters

Name
Type
Description
_minter
address
address to set
_set
bool
true to set, false to reset

symbol

function symbol() external view returns (string)
Token symbol

Returns

Name
Type
Description
_0
string
undefined

totalInstantPower

function totalInstantPower() external view returns (uint256)
total instant voting power

Returns

Name
Type
Description
_0
uint256
undefined

totalSupply

function totalSupply() external view returns (uint256)
Returns current total voting power

Returns

Name
Type
Description
_0
uint256
undefined

transfer

function transfer(address, uint256) external pure returns (bool)
Execution of function is prohibited to disallow token movement

Parameters

Name
Type
Description
_0
address
undefined
_1
uint256
undefined

Returns

Name
Type
Description
_0
bool
undefined

transferFrom

function transferFrom(address, address, uint256) external pure returns (bool)
Execution of function is prohibited to disallow token movement

Parameters

Name
Type
Description
_0
address
undefined
_1
address
undefined
_2
uint256
undefined

Returns

Name
Type
Description
_0
bool
undefined

updateUserVotingPower

function updateUserVotingPower(address user) external nonpayable
update gradual user voting power
also updates global gradual voting power Requirements: - the caller must be the gradual minter

Parameters

Name
Type
Description
user
address
user address to update

updateVotingPower

function updateVotingPower() external nonpayable
updates global gradual voting power
Requirements: - the caller must be the gradual minter

userInstantPower

function