Unissued Tokens and the Treasury

Final Flush If all the setups in a contract are inactive, there are no more positions open and there is no more liquidity in the setups (all users have withdrawn their liquidity), the host can call the finalFlush to send all unissued reward tokens from the Farming contract to the treasury (or to the host address himself in case a treasury address was not set).

This allows the host to recover all unissued tokens but in the safest conditions for farmers, preventing hosts from using the flush function maliciously to steal rewards or liquidity.

Unissued Tokens Due to No Open Positions

Tokens become unissued if no farmers had an open position in an active setup when a block passed (even if only there had been only one, they would have received all of the rewards for that block).

For example:

Free setup

Reward per Block: 0.5 BUIDL

Duration in blocks (calculated as EndBlock - StartBlock): 1000

Total rewards held by the treasury: 1000 * 0.5 = 500 Buidl

From block 1 to block 100, no one farms this setup. From block 101 to 500, there is at least one farmer. From block 501 to 700, no one farms the setup. Finally, from block 701 to 1000 (the EndBlock), there is at least one farmer.

In this scenario, the unissued reward tokens are:

(100*0.5) = 50 -> unissued from 0 to 100

+

(200*0.5) = 100 -> unissued from 500 to 700

= 150 total unissued BUIDL

Unissued Tokens From Setup Deactivation

When a setup is deactivated by its host, the amount of unissued tokens is calculated as RewardPerBlock*(EndBlock-current block). These are immediately sent to the treasury address.

For example:

Setup RewardPerBlock: 0.5 BUIDL

Setup StartBlock: 12087477

Setup EndBlock: 12088477

Duration: 1000 blocks

Total reward tokens held by the treasury: 0.5*1000=500

The host deactivates the setup at block 12087977. The amount of tokens sent back to the treasury is equal to 0.5*(12088477-12087977) = 250.

Unissued Tokens From Changing the Reward Per Block

If the host ever reduces the rewards per block for a setup, there will be excess tokens in it when it ends (calculated as(old RpB-new RpB) * remaining blocks until end block). These are added to the total amount of unissued tokens.

Last updated