Unissued Tokens and the Treasury

Unissued Tokens

There are three scenarios in which tokens are returned to the extension. The first concerns unissued tokens from positions; the second, with unissued tokens following setup deactivation; the third, with changes in the Reward per Block of a Free setup.

Unissued Tokens From Positions:

Unissued reward tokens are those that were not distributed to farmers after a given block. Free Setups For Free setups, there will only ever be unissued rewards tokens if a block passes with no active farmers. If there is even one, they will receive all rewards for that block in accordance with free farming logic.

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 (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 BUIDL total unissued

Locked Setups

For Locked setups, unissued reward tokens are those not distributed to farmers as a result of not enough liquidity being staked in positions over the limited period the setup is available. If per block the max stakeable of the setup is covered by the liquidity (in main tokens) entered by users, there are no unused tokens. If per block the max stakeable is greater than the liquidity (in main tokens) entered by users ,there will be unused tokens, calculated as :

RewardPerBlock - (RewardPerBlock-(RewardPerBlock*(main token amount staked/Max.Steakable main token amount))*number of blocks


Locked setup

Reward Per Block: 0,5 BUIDL

Duration (calculated as EndBlock - StartBlock): 1000

Total rewards held by the extension: 1000*0,5= 500 BUIDL

MaxStakable: 20000 UniFi

from block 1 to 100, we have 10000 UniFi staked. from block 101 to 200, we have 15000 UniFi staked, from block 201 to 500, we have 9000 UniFi staked. From block 501 to 700 we have 12000 UniFi staked. from block 701 to 800 we have 18000 UniFi staked. And from block 801 to 1000 (the EndBlock), we have the entire 20000 amount of UniFi staked.

In this Locked setup scenario, we have a total amount of unissued reward token of:

0,5-(0,5*(10000/20000))*100= 25


0,5-(0,5*(15000/20000))*100= 12,5


0,5-(0,5*(9000/20000))*300= 82,5


0,5-(0,5*(12000/20000))*200= 40


0,5-(0,5*(18000/20000))*100= 5


0,5-(0,5*(20000/20000))*100= 0

= 170 Buidl

Unissued Tokens From Setup Deactivation

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

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 (only for Free Setups)

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.

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.

Last updated