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.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 setupReward per Block: 0.5 BUIDLDuration in blocks (calculated as EndBlock - StartBlock): 1000Total rewards held by the treasury: 1000 * 0.5 = 500 BuidlFrom 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 BUIDLSetup StartBlock: 12087477Setup EndBlock: 12088477Duration: 1000 blocksTotal reward tokens held by the treasury: 0.5*1000=500The host deactivates the setup at block 12087977. The amount of tokens sent back to the treasury is equal to 0.5*(12088477-12087977) = 250.
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 modified 2yr ago