Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling legacy staking (Nu & Keep tokens) end of support #112

Closed
8 tasks done
manumonti opened this issue Dec 13, 2023 · 3 comments
Closed
8 tasks done

Handling legacy staking (Nu & Keep tokens) end of support #112

manumonti opened this issue Dec 13, 2023 · 3 comments
Assignees

Comments

@manumonti
Copy link
Member

manumonti commented Dec 13, 2023

Context

Before the Threshold network emerged, there were Nu and Keep stakers. Up to now, these users have been earning staking rewards. To achieve this, the legacy tokens were accepted in the TokenStaking contract, establishing a conversion between these tokens and the T token through the VendingMachine contract.

These converted tokens have been treated as a special case in the TokenStaking contract, so these were not T tokens, but nuInT and keepInT tokens. Either way, the staking rewards have been calculated from nuInT and keepInT values in the same way that the staked T.

Since it has been planned to stop supporting these legacy stakers, there was an update on staking contracts, so these tokens nuInT and keepInT are no longer eligible to earn rewards.

This is the tx where this happened:
https://etherscan.io/tx/0x68ddee6b5651d5348a40555b0079b5066d05a63196e3832323afafae0095a656#eventlog

The changes made consisted of the legacy tokens being unstaked. So subgraph queries return 0 stakes with nuInT or keepInT greater than 0.

Also, these tokens nuInT and keepInT have been used as authorization amount in tBTC and RandomBeacon apps. So, in addition to the unstaking of these tokens, the authorization amount has been decreased. InvoluntaryAuthorizationDecrease events were emitted (see tx logs in Etherscan link above).

So, now, the stakers can withdraw their NU/KEEP tokens from the legacy NU/KEEP staking contracts, upgrading them to T and stake resulting T. If they do this before the deadlines, they will receive all the rewards even when there is a transition period in which they didn't be eligible for rewards. The process to achieve this is described here: https://forum.threshold.network/t/transition-guide-for-legacy-stakers/719

Also, see threshold-network/solidity-contracts#141.

Action points

Additional work

@manumonti
Copy link
Member Author

manumonti commented Dec 13, 2023

List of legacy stakes affected:

Legacy staking provider list
'0x01474098607ed064f72832e1491b2261967166da',
'0x04670e07912b3764cc1ccf1c22ad0f35b95e9ba0',
'0x06eb8d86cbc1693079d2ff0fa9cb55a26cd07f15',
'0x07c9a8f8264221906b7b8958951ce4753d39628b',
'0x0ace6419dbdab7f9330568258b9ddb37a295b677',
'0x229beeaa51590c3abbc628af55283b73ed2dbf9d',
'0x25d9bbb4eccbf3a5e6d6bbce9813302e508f321d',
'0x33769235a2980730ae7e17fc6eaf4740530cde1b',
'0x378c89b5b93667a005856822e1b65e2d7c076373',
'0x1147ccfb4aefc6e587a23b78724ef20ec6e474d4',
'0x456d643cd97b058fd3bbbeb76f04b1de3679bc6a',
'0x650a9ed18df873cad98c88dcac8170531cad2399',
'0x4d3c343d4bd676e4098336ef75f1d717149623a1',
'0xd977144724bc77faefae219f958ae3947205d0b5',
'0x56c968857ef4919c67d151b56e7073065994c97a',
'0xcbb734bba70c6462a9f22c2b481346ebef3cfad3',
'0x700277deaf138c6af9b3177f83918b6a3544f27f',
'0x2ebe08379f4fd866e871a9b9e1d5c695154c6a9f',
'0x8cc46611bec3217d058d92fd234a8ed7d205e0d2',
'0x83237ba2b7d0bf23090196fccbfb2be1ef21580d',
'0x855a75f56706d7be02e2d20b74a0725abbdc453e',
'0x4bfa10b1538e8e765e995688d8eec39c717b6797',
'0x8868240903e44c7cb8bc5a5158f3de10707644e9',
'0x8d0b183b68cc93b9f9e1490c85b4a4965ef5cd3b',
'0x8d34285c047d5d8757551baa45e471e62e72f468',
'0x9919c9f5cbbaa42cb3bea153e14e16f85fea5b5d',
'0x3b9e5ae72d068448bb96786989c0d86fbc0551d1',
'0xa2e44666bab3ed3be4f87b7c18ed2ffb911c0bef',
'0xa6a2ae15f74f1e3f574f419a8853f0c9b095bc48',
'0xa829c2e33907ab03d27d5dbb39effd8386112789',
'0xb70c8d55d397aa5d76f96c64b3e4084db95c739e',
'0xa4166c3e14cbdd6d4494945a99616f1c73ad9699',
'0xaea619d02dcf7299fb24db2f60a08bfc8fb2dbcf',
'0xca70fea021359778daec479b97d0cd2efe1ad099',
'0xdcd4199e22d09248ca2583cbdd2759b2acd22381',
'0xfc97a906c715587b56c2c65a07ce731ba80339de',
'0xc82bed104c3d5785fecebf906e5b1747a1bce681',
'0xcd087a44ed8ee2ace79f497c803005ff79a64a94',
'0xce4407df6ae8a92eb69412bd6a8ec49a9b9b40dd',
'0xd0908b1e0f6e64e3097c663bf95e2e9c040dd40d',
'0xd680b01503cf95a489010da7409980060991d096',
'0xd6edf0bc0c19f87ecef67632bfcd212ce8324ab9',
'0x341154298ab7ca86278df9665fb2b8610b92214d',
'0xe26e2d93bbc8fde0e1e3b290fc927fb374e7e34e',
'0xa5f6822ef1a7df72628259f9d1dc17eb2bcb2385',
'0x045e511f53debf55c9c0b4522f14f602f7c7ca81',
'0xf9283ac13aec8a2b60a56a82f1f5e4da1742ccf8',
'0xfd771e3e34a93e19caad4c11c3be16c70d5ec2fd'

Legacy stakes authorizations:
https://gist.github.com/manumonti/3d5c82bffd43476838d6093deaa73de7

Monitoring legacy stakes staked amount:
https://gist.github.com/manumonti/198e3fe2f9d4b5f0442b6354ff8ffa8b

@manumonti
Copy link
Member Author

Related issues: #95

@manumonti manumonti self-assigned this Dec 13, 2023
manumonti added a commit that referenced this issue Feb 1, 2024
As this is a cumulative Merkle distribution, the rewards here collected
are the sum of the rewards distributed in previous Merkle distributions
plus the rewards earned in the period between the last and the current
distribution.

The rewards earned in this distribution are determined for the period
between Jan 1st 2024 and Feb 1st 2024 and include:

- One-off Commitment Bonus: this is a incentive for longer staking
  commitments at genesis. Stakes that did the lock-up extension before
  January 15th, 2024 (UTC 23:59:59) received an extra yield that varies
  according to the extra lock-up period choosen [1].

- TACo rewards: for those that have a TACo operator confirmed and were
  staking T and authorized TACo application for the period Jan 1st 24 -
  Feb 1st 24.

- tBTCv2 rewards: for those that complied with the tBTCv2 requirements
  for the period Jan 1st 24 - Feb 1st 24. Note that stakes with legacy
  Keep staking won't be included in this distribution. See note below.

The rewards allocation for this distribution is 25% for TACo rewards and
75% for tBTC rewards.

Note: No rewards for stakes with legacy Keep. Since the deadline for the
legacy tokens transtion has not yet ended for legacy Keep staking, and
considering that stakes which completed the process will earn the
complete amount of rewards for their legacy tokens at the end of the
process, but those that won't complete the process in time won't, it is
not possible to know how much rewards have been calculated for those
stakes with legacy tokens. For this reason, no rewards have been
calculated for legacy stakes in this distribution period. In future
distributions after the transition deadline, the remaining rewards will
be distributed. Info: [2] [3].

[1] https://docs.threshold.network/staking-and-running-a-node/taco-node-setup/taco-authorization-and-operator-registration/one-off-commitment-bonus
[2] https://forum.threshold.network/t/transition-guide-for-legacy-stakers/719
[3] #112
manumonti added a commit to threshold-network/staking-subgraphs that referenced this issue Feb 15, 2024
To calculate the pending legacy Keep rewards [1] it is necessary to know
if the stakes are elegible for legacy PRE rewards.

To know this, it is necessary to have (again) this subgraph.

[1] threshold-network/merkle-distribution#112
manumonti added a commit to threshold-network/staking-subgraphs that referenced this issue Feb 15, 2024
To calculate the pending legacy Keep rewards [1] it is necessary to know
if the stakes are elegible for legacy PRE rewards.

To know this, it is necessary to have (again) this subgraph.

[1] threshold-network/merkle-distribution#112
manumonti added a commit to threshold-network/staking-subgraphs that referenced this issue Feb 15, 2024
To calculate the pending legacy Keep rewards [1] it is necessary to know
if the stakes are elegible for legacy PRE rewards.

To know this, it is necessary to have (again) this subgraph.

[1] threshold-network/merkle-distribution#112
manumonti added a commit that referenced this issue Feb 26, 2024
As this is a cumulative Merkle distribution, the rewards here collected
are the sum of the rewards distributed in previous Merkle distributions
plus the rewards earned in the period between the last and the current
distribution.

Note that this is a special distribution, and the date of this
distribution is the date of legacy Keep staking transition deadline [1].

This distribution releases the frozen rewards of legacy Keep stakes. As
mentioned on #112, the rewards for legacy Keep stakes had been frozen
during the legacy staking transition period. Once this period has ended,
the rewards have been released:

This distribution also includes the "regular" stakes rewards (i.e. the
rewards for the stakes that didn't have legacy Keep tokens).

- tBTC rewards for those non-legacy stakes for the period Feb 1st 24 -
  Feb 24th 24.
- TACo rewards for those non-legacy stakes for the period Feb 1st 24 -
  Feb 24th 24.
- tBTC rewards for those that had legacy Keep tokens (keepInT) on Nov
  22nd 23. The rewards are for the period Nov 22nd 2023 - Feb 24th 2024.
  The conditions to be eligible for these rewards are:
  - To have a tBTC client running and complying with the usual
    requirements: pre_params, uptime, and client version.
  - To have tokens staked and authorized to the two Threshold apps:
    Random Beacon and WalletRegistry (aka tBTC). The rewards are
    calculated from two sources: (a) the `T` tokens staked and
    authorized to both apps and (b) the `keepInT` tokens if these have
    been re-staked and re-authorized for both apps during the transition
    period.
- PRE rewards for those that had legacy Keep tokens (keepInT) on Nov
  22nd 23. The rewards are for the period Nov 22nd 2023 - Feb 1st 2024
  (date of PRE deactivation). The conditions to be eligible for these
  rewards are:
  - To have a PRE operator confirmed on Nov 22nd 2023.
  - To have tokens staked. Staked `T` tokens will be considered for the
    rewards calculation. Staked `keepInT` tokens will be considered only
    in the case the stake re-staked it during the transition period.
- TACo rewards for the period Feb 1st 2024 - Feb 24th 2024. The
  condition to be eligible for these rewards are:
  - To have a TACo operator confirmed.
  - To have TACo application authorized.

This PR closes #95, #112.

[1] https://forum.threshold.network/t/transition-guide-for-legacy-stakers/719
@manumonti
Copy link
Member Author

All tasks have been finalized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant