vlAlluo Architecture

Basics

vlAlluo is the contract that brings voting power to whole Alluo ecosystem. Every $ALLUO holder in order to cast votes in Alluo Snapshot space has to lock their tokens in vlAlluo contract.

Another benefit of locking $ALLUO is passive income - all unrealized APY is distributed between lockers, proportionally their locking amount and time. This motivates lockers to participate in Alluo DAO votes, specifically for Liquidity Direction proposals.

Depending on results of the votes that happens every 2 weeks, $ALLUO token can be also minted and distributed between lockers.

Unrealized APY is distributed in $CVX tokens. When claiming rewards, both $ALLUO and $CVX are transferred - AlluoLockedV4 is responsible for $ALLUO distribution and CvxDistributor is responsible for $CVX distribution.

As user locks his tokens, he will be able to submit withdraw request only in 7 days. When user submits withdraw request, user will be able to receive $ALLUO only in 5 days. All rewards are distributed on every Ethereum Mainnet block and available to claim immediately.

Deployments

AlluoLockedV4 proxy: 0xdEBbFE665359B96523d364A19FceC66B0E43860D

CvxDistributor proxy: 0xc22DB2874725B84e99EC0a644fdD042EA3F6F899

Details

AlluoLockedV4 is main contract that frontend interacts with. It communicates with CvxDistributor delivering info info about lock/unlock amounts and requesting to deliver rewards, if user is requests to claim his rewards.

AlluoLockedV4 contract interface

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IAlluoLockedV4 {
    function alluoToken() external view returns (address);

    function balanceOf(address _address) external view returns (uint256 amount);

    function changeUpgradeStatus(bool _status) external;

    function claim() external;

    function cvxDistributor() external view returns (address);

    function decimals() external view returns (uint8);

    function depositLockDuration() external view returns (uint256);

    function distributionTime() external view returns (uint256);

    function exchange() external view returns (address);

    function getClaim(address _locker) external view returns (uint256 reward);

    function getClaimCvx(address locker) external view returns (uint256 reward);

    function getInfoByAddress(address _address)
        external
        view
        returns (
            uint256 locked_,
            uint256 unlockAmount_,
            uint256 claim_,
            uint256 claimCvx_,
            uint256 depositUnlockTime_,
            uint256 withdrawUnlockTime_
        );

    function lock(uint256 _amount) external;

    function migrateWithdrawOrClaimValues(
        address[] memory _users,
        bool _withdraw
    ) external;

    function migrationLock(address[] memory _users, uint256[] memory _amounts)
        external;

    function name() external view returns (string memory);

    function oldClaim(address) external view returns (uint256);

    function oldWithdraw(address) external view returns (uint256);

    function pause() external;

    function paused() external view returns (bool);

    function rewardPerDistribution() external view returns (uint256);

    function setCvxDistributor(address cvxDistributorAddress) external;

    function setReward(uint256 _amount) external;

    function symbol() external view returns (string memory);

    function totalDistributed() external view returns (uint256);

    function totalLocked() external view returns (uint256);

    function totalSupply() external view returns (uint256 amount);

    function unlock(uint256 _amount) external;

    function unlockAll() external;

    function unlockedBalanceOf(address _address)
        external
        view
        returns (uint256 amount);

    function unpause() external;

    function update() external;

    function updateDepositLockDuration(uint256 _depositLockDuration) external;

    function updateWithdrawLockDuration(uint256 _withdrawLockDuration) external;

    function upgradeStatus() external view returns (bool);

    function waitingForWithdrawal() external view returns (uint256);

    function withdraw() external;

    function withdrawLockDuration() external view returns (uint256);

    function withdrawTokens(
        address withdrawToken,
        address to,
        uint256 amount
    ) external;
}

AlluoLockedV4 functions descriptions

alluoToken()

View function. Constant. Always returns address of $ALLUO token: 0x1E5193ccC53f25638Aa22a940af899B692e10B09

balanceOf(address _address)

View function. Returns amount of vlAlluo that _address has. This function shows voting power of specific address.

changeUpgradeStatus(bool _status)

Can be only called by member of DEFAULT_ADMIN_ROLE. This function is setting upgrade status of the contract, that is false by default. If set to true, anyone with UPGRADER_ROLE is allowed to execute upgrade of the contract. After upgrade execution, upgrade status is reset to false.

claim()

Claims all available rewards (both $CVX and $ALLUO) for msg.sender. All rewards are immediately transferred to msg.sender. Reverts if no rewards are available for the user.

cvxDistributor()

View function. Returns CvxDistributor contract address that is responsible for $CVX distribution calculations and rewards

decimals()

View functon. Constant. Always returns 18, representing the decimals places of vlAlluo.

depositLockDuration()

View functon. Returns time duration after $ALLUO locking in seconds required to wait before submitting withdraw request.

distributionTime()

View functon. Returns time duration in seconds, represents within what amount of time specified amount of tokens is distributed among lockers. Amount of tokens can be seen in rewardPerDistribution() view function and can be changed by DEFAULT_ADMIN_ROLE in setReward(uint256 _amount)

exchange()

View function. Constant. Always returns address of Alluo protocol Exchange contract: 0x29c66CF57a03d41Cfe6d9ecB6883aa0E2AbA21Ec

getClaim(address _locker)

View function. Returns amount of $ALLUO available for immediate claim for _locker.

getClaimCvx(address _locker)

View function. Returns amount of $CVX available for immediate claim for _locker.

getInfoByAddress(address _address)

View function. Returns set of information about locker _address:

  • locked_ - amount of $ALLUO locked, represents vlAlluo balance

  • unlockAmount_ - amount of $ALLUO pending for withdrawal. Withrawal will be available after withdrawUnlockTime_

  • claim_ - amount of $ALLUO available for immediate claim

  • claimCvx_ - amount of $CVX available for immediate claim

  • depositUnlockTime_ - UNIX timestamp, when user will be able to request withdraw after $ALLUO deposit

  • withdrawUnlockTime_ - UNIX timestamp, when user will be able to withdraw $ALLUO after requesting to withdraw. Amount available for withdraw is shown in unlockAmount_.

lock(uint256 _amount)

Transfers _amount of $ALLUO from user and locks them in the contract. Requires approve to be called on $ALLUO token to vlAlluo proxy address before locking.

As user locks his tokens, he will be able to submit withdraw request only in 7 days. When user submits withdraw request, user will be able to receive $ALLUO only in 5 days.

migrateWithdrawOrClaimValues(address[] memory _users, bool _withdraw)

Can be only called by members of DEFAULT_ADMIN_ROLE. Function copies information about all users in _users array from old contract. If _withdraw is true, pending withdrawals information is copied, otherwise available $ALLUO rewards are copied.

migrationLock(address[] memory _users, uint256[] memory _amounts)

Can be only called by members of DEFAULT_ADMIN_ROLE. Function creates locking position for every user _users[i] with amount _amounts[i] of vlAlluo. Used only for migration to the current version of vlAlluo contract.

name()

View function. Constant. Always returns string "Vote Locked Alluo Token"

oldClaim(address user)

View function. Returns claim amount migrated from previous vlAlluo contract. This amount will be distributed right when users calls claim(), after that migrated claim amount will be reset to 0.

oldWithdraw(address user)

View function. Returns available $ALLUO withdraw amount migrated from previous vlAlluo contract. This amount will be distributed right when users calls withdraw(), after that migrated withdraw amount will be reset to 0.

pause()

Can be only called by members of DEFAULT_ADMIN_ROLE. Function pauses all locking, claiming, withdraw operations on the contract.

paused()

View function. Returns true if all locking, claiming, withdraw operations on the contract are paused. false otherwise.

rewardPerDistribution()

View function. Shows amount of $ALLUO token to be distributed among all lockers within time period in seconds returned by function distributionTime().

setCvxDistributor(address cvxDistributorAddress)

Can be only called by members of DEFAULT_ADMIN_ROLE. Function sets the new address of CvxDistributor contract, responsible for $CVX rewards distribution.

setReward(uint256 _amount)

Can be only called by members of DEFAULT_ADMIN_ROLE. Function sets amount of $ALLUO tokens to be distributed among lockers within time period in seconds returned by function distributionTime().

symbol()

View function. Constant. Always returns string "vlAlluo".

totalDistributed()

View function. Shows amount of $ALLUO totally distributed by current version of the contract.

totalLocked()

View function. Shows total amount of $ALLUO totally locked. Represents total voting power of the protocol.

totalSupply()

View function. Returns same value as function totalLocked()

unlock(uint256 _amount)

Submits request from user to withdraw locked $ALLUO tokens. Voting power and vlAlluo balance of the user is reduced instantly upon successful unlock. Reverts if user is sending request to unlock earlier than getInfoByAddress(msg.sender).depositUnlockTime_, or if user attempts to unlock amount of tokens exceeding his vlAlluo balance.

unlockAll()

Submits request from user to withdraw all locked $ALLUO tokens. Voting power and vlAlluo balance of the user will be set to 0 upon successful unlock. Reverts if user is sending request to unlock earlier than getInfoByAddress(msg.sender).depositUnlockTime_, or if user has nothing to unlock.

unlockedBalanceOf(address _address)

View function. Shows amount of $ALLUO pending for withdraw. Withdraw of tokens will be available after getInfoByAddress(_address).withdrawUnlockTime_

unpause()

Can be only called by members of DEFAULT_ADMIN_ROLE. Function resumes all locking, claiming, withdraw operations on the contract.

update()

This function recalculates all variables regarding $ALLUO distribution.

updateDepositLockDuration(uint256 _depositLockDuration)

Can be only called by members of DEFAULT_ADMIN_ROLE. Updates amount of time required to pass after user locks $ALLUO before he can submit withdraw request.

updateWithdrawLockDuration(uint256 _withdrawLockDuration)

Can be only called by members of DEFAULT_ADMIN_ROLE. Updates amount of time required to pass after user unlocks $ALLUO before he can receive unlocked $ALLUO.

upgradeStatus()

View function. Returns true if contract upgrade is available for members of UPGRADER_ROLE, false otherwise.

waitingForWithdrawal()

View functions. Returns total amount of $ALLUO pending for withdraw.

withdraw()

Transfers all user unlocked $ALLUO tokens to the user. Reverts if user did not unlock any tokens, or if user is sending request to withdraw earlier than getInfoByAddress(msg.sender).withdrawUnlockTime_

withdrawLockDuration()

View functon. Returns time duration after $ALLUO unlocking in seconds required to wait before executing withdraw.

withdrawTokens(address withdrawToken, address to, uint256 amount)

Can be only called by members of DEFAULT_ADMIN_ROLE. Transfers specified token and amount from contract balance to specified address.

Last updated