Skip to content

lidofinance/balancer-rewards-manager

Repository files navigation

Balancer rewards manager

This repository contains rewards manager for Balancer Liquidity Gauge. The manager simplifies reward distribution operations by DAO voting and Easy Track.

Environment preparation with Poetry

Step 1. Install dependencies

poetry install

Step 2. Activate newly created environment

poetry shell

Testing

brownie test -s

Deploying Environment

The deploy.py script is in charge of the RewardsManager contract on-chain deployment. The following environment variables needs to be set for the script's execution:

  • DEPLOYER - deployer account

Specification

def period_finish() -> uint256: view

Returns estimated date of last rewards period start date

BLG.periodFinish + (WEEKS_PER_PERIOD - self.rewards_iteration ) % WEEKS_PER_PERIOD * SECONDS_PER_WEEK

def start_next_rewards_period()

Permissionless method, allows to start new weekly rewards period at Balancer Liquidity Gauge

If contact has enough assets in it (LDO.balanceOf(self) >= self.weekly_amount), and the BLG period is finished, it will start a new period by calling deposit_reward_token(_reward_token: address, _amount: uint256): nonpayable with self.weekly_amount as amount of LDO

Recalculates self.weekly_amount every 4 calls, requires balance to be not less then self.min_rewards_amount

Events:

event NewRewardsPeriodStarted:
    amount: uint256
event WeeklyRewardsAmountUpdated:
    newWeeklyRewardsAmount: uint256

def balancer_period_finish() -> uint256: view

Returns timestamp of current period ending at Balancer Liquidity Gauge

def is_balancer_rewards_period_finished() -> bool: view

Sign of ending of current rewards period at Balancer Liquidity Gauge

def replace_me_by_other_distributor(_to: address):

Transfers permission to start new rewards period form self.

Events:

event RewardsContractTransferred:
    newDistributor: indexed(address)

def set_rewards_contract(_rewards_contract: address):

event RewardsContractUpdated:
    newRewardsContract: indexed(address)

def recover_erc20(_token: address, _amount: uint256, _recipient: address = msg.sender):

Transfers the amount of the given ERC20 token to the recipient. Can be called by owner only.

Events:

event ERC20TokenRecovered:
    token: indexed(address)
    amount: uint256
    recipient: indexed(address)

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages