---
tags: Spec-Revenue-Sharing
---
# Forced Take-out Example Scenario V2/Final
NOTE: All token values were multiplied by 10, to make them past the minimum stake of 65. Test still works fine. TODO: change them into this doc?
The following scenario works through the primary features of the forced take out mechanism.
## Start
<b>State:</b>
Delegator 1: 10 Pool Tokens, 0 Data
Delegator 2: 10 Pool Tokens, 0 Data
Delegator 3: 10 Pool Tokens, 0 Data
Broker Pool: 30 Pool Value, 0 Free Funds, 20 Staked on Stream 1 + 10 Staked on Stream 2
Withdraw Queue: Empty
t: 0
<b>Parameters</b>
grace_period: 30 Days
## Delegator 1 Puts All Tokens in Withdraw Queue at t = 0
<b>State:</b>
Delegator 1: 10 Pool Tokens, 0 Data
Delegator 2: 10 Pool Tokens, 0 Data
Delegator 3: 10 Pool Tokens, 0 Data
Broker Pool: 30 Pool Value, 0 Free Funds, 20 Staked on Stream 1 + 10 Staked on Stream 2
Withdraw Queue: [(Address = Delegator 1 Address, Tokens =10 Pool Tokens, t=0)]
t: 0
## Delegator 2 Puts 10 Tokens in Withdraw Queue at t = 5
<b>State:</b>
Delegator 1: 10 Pool Tokens, 0 Data
Delegator 2: 10 Pool Tokens, 0 Data
Delegator 3: 10 Pool Tokens, 0 Data
Broker Pool: 30 Pool Value, 0 Free Funds, 20 Staked on Stream 1 + 10 Staked on Stream 2
Withdraw Queue: [(Address = Delegator 1 Address, Tokens =10 Pool Tokens, t=0),(Address = Delegator 2 Address, Tokens =10 Pool Tokens, t=5)]
t: 5
## Delegator 1 Calls Force Withdraw at t = 29, with stream 1 as the target
Revenue earning is called and no revenue is there so nothing happens.
Then the top of the withdraw queue is checked and it has t = 0. Since 29 - 0 < grace_period = 30, nothing happens and it terminates.
<b>State:</b>
Delegator 1: 10 Pool Tokens, 0 Data
Delegator 2: 10 Pool Tokens, 0 Data
Delegator 3: 10 Pool Tokens, 0 Data
Broker Pool: 30 Pool Value, 0 Free Funds, 20 Staked on Stream 1 + 10 Staked on Stream 2
Withdraw Queue: [(Address = Delegator 1 Address, Tokens =10 Pool Tokens, t=0),(Address = Delegator 2 Address, Tokens =10 Pool Tokens, t=5)]
t: 6
## Broker Unstakes 5 DATA from Stream 1 at t = 29
The broker unstakes 5 DATA which immediately goes to paying off 5 of the tokens (1 to 1 exchange rate here). The values are changed for delegator 1, broker pool, and the first withdraw queue item
<b>State:</b>
Delegator 1: 5 Pool Tokens, 5 Data
Delegator 2: 10 Pool Tokens, 0 Data
Delegator 3: 10 Pool Tokens, 0 Data
Broker Pool: 25 Pool Value, 0 Free Funds, 15 Staked on Stream 1 + 10 Staked on Stream 2
Withdraw Queue: [(Address = Delegator 1 Address, Tokens = 5 Pool Tokens, t=0),(Address = Delegator 2 Address, Tokens =10 Pool Tokens, t=5)]
t: 6
## Delegator 2 Calls Force Withdraw on Stream 1 at t = 31
Revenue earning is called and no revenue is there so nothing happens.
Then the top of the withdraw queue is checked and it has t = 0. Since 31 - 0 > grace_period = 30, the stream is liquidated and 15 DATA is now free to pay off with withdraw queue.
First 5 DATA pays off the withdraw queue item for delegator 1. However, 10 DATA is left over. <b>Even though the queue item for delegator 2 is not older than 7 days, this 10 DATA is used to pay it off. This represents an attack vector because the 5 DATA stream would have sufficed.</b>
<b>State:</b>
Delegator 1: 0 Pool Tokens, 10 Data
Delegator 2: 0 Pool Tokens, 10 Data
Delegator 3: 10 Pool Tokens, 0 Data
Broker Pool: 10 Pool Value, 0 Free Funds, 0 Staked on Stream 1 + 10 Staked on Stream 2
Withdraw Queue: []
t: 8