Badger Finance
Search…
Sett User Guides - Binance Smart Chain (BSC)
Governance
Token Distribution
WIP Badger Registry
Pre Launch
Coding Conventions - Harvest for all Strategies
These coding conventions are meant to make it easy for new developers to get onboarded, while allowing the dev team to integrate, interact and track the strategy without having to write custom code
The harvest function is supposed to claim rewards, compound them into more want, and for partner strategies, send the partner token to the badger tree so it can be distributed

Facilitating use of Flashbots

The harvest function will return a uint256 this represents how much the harvest function earned, in want.

Calculating APY

The harvest function will emit the Harvest(uint256 amount, uint256 block.time) event to facilitate APY calculations

Sending rewards to the badger tree

If the strategy sends rewards to the badger tree, it can signal the amount sent via the event emit TreeDistribution(address Token, uint256 amount, uint256 block.number, uint256 block.timestamp)
This will be used by the Badger Tree bots to calculate rewards

Calculating Performance Fees

Pass the amount earned to _processPerformanceFees, this function will calculate and transfer the fees to strategist and the DAO.

Calculating Performance Fees on Non-want (partner tokens)

Similarly, pass in the Amount as well as the token address to receive performance fees on tokens we don't auto-compound into want
Last modified 4mo ago
Copy link