graphprotocol / mission-control-indexer

Technical indexer documentation and infrastructure templates for the Mission Control testnet
21 stars 4 forks source link

TokenLock contract does not allow withdrawSurplus without unstaking #264

Open madumas opened 3 years ago

madumas commented 3 years ago

If I interpret the wording from the notion guide (https://www.notion.so/Graph-Network-Token-Lock-Contract-Guide-30992eea5f4b47c8b4c6ff7a9bc56a41) correctly, in order to be able to withdraw your gains from indexing rewards, rebate rewards or query rewards from the Token Lock contract you need to have a surplus in the contract itself.

meaning: surplus = Max(currentBalance + remaining_vested_amount, 0)

So in order to withdrawSurplus before the end of the vesting period, you need need to unstake the quasi-totality of your GRT so you can show to the TokenLock contract that you indeed have a surplus. That implies that to withdraw your surplus, you have to forego 28 days of revenues.

TokenLock contract should calculate surplus = Max ( currentBalance + staking_balance - remaining_vested_amount, 0)