Skip to content

Latest commit

 

History

History
75 lines (44 loc) · 5.23 KB

TIP-181.md

File metadata and controls

75 lines (44 loc) · 5.23 KB
id Title Status Author Description Discussions to Created
TIP-181 Chainlink CCIP THALES Cross-chain Staking Draft Kiril (Thales), Michael I (Chainlink Labs) Use CCIP to unify THALES staking across all supported networks discordlink 2023-11-08

Simple Summary

Use Chainlink Cross-Chain Interoperability Protocol (CCIP) to synchronize THALES token staking across all supported networks.

Abstract

Currently THALES staking is separately deployed on Optimism, Arbitrum and Base with their own isolated reward pools and isolated rewards calculations.

This TIP proposes synchronizing staking rewards across all supported networks by unifying all the dedicated-per-chain rewards into a concept of total-cross-chain rewards using Chainlink Cross-Chain Interoperability Protocol (CCIP).

At the end of every staking period, Chainlink CCIP is used to distribute the total rewards across all chains.
With the TIP-182 voted in, the protocol fees will be distributed using the same approach.

Motivation

Currently, staking rewards on every supported network (Optimism, Arbitrum, and Base) are distributed independently from each other with isolated rewards pools. This causes each network to have different base and bonus staking rewards each week from other staking instances on other networks. Stakers on one network may receive less rewards for the equal amount of staked THALES and less gamified staking points compared to other stakers on other networks. Additionally, this led to some stakers attempting to unstake from one network, bridge their assets, and stake them on another network in pursuit of better yield. With this proposal, such actions will no longer be necessary.

In order to bring cross-chain balance to THALES token staking, this TIP proposes to unify the emitted rewards from all networks into a single cross-chain pool of rewards using Chainlink CCIP. For example, if the current fixed base rewards are X THALES on Optimism and Y THALES on Base, the total base rewards would be ( X + Y ) THALES split pro-rata across all stakers on Optimism and Base. A staker on Optimism and a staker on Base with an equal staked amount would receive an equal amount of base rewards.

The same can be said for the gamified/bonus bucket. Using the example above, if we have gamified staking rewards X THALES on Optimism and Y THALES on Base, the total gamified rewards pool (X + Y) would be split up pro-rata between all the stakers eligible for gamified rewards, regardless of the chain.
The protocol fees will be distributed in the same manner.

We chose CCIP as our interoperability solution because Chainlink has a proven track record for maintaining the highest standards of security and reliability, which is also why THALES currently uses Chainlink Data Feeds. CCIP operates at the highest level of cross-chain security by taking a defense-in-depth approach, where multiple decentralized oracle networks and an independent Risk Management Network secure each transaction.

The details of the implementation are laid out in the Specification section.

Specification

At the end of each staking period these actions are performed to distribute the rewards:

  1. Collecting staking amounts and protocol fees from all chains:
    Staking contracts from each network send the staking amount and the protocol fees data to a Collector contract on the "main" network (e.g. Optimism) using a CCIP.
  2. Calculating rewards per chain:
    The Collector contract calculates the rewards per network based on the total rewards to be distributed and the staked amount per chain. The protocol fees per network are calculated in the same manner, the total protocol fees are distributed respectively to the staked amount per chain/network.
  3. Distributing rewards per chain:
    The Staking contract on each network is updated via CCIP message with the amount of rewards for the current period. After this amount is updated, stakers can claim the rewards.
  4. Distributing protocol fees per chain:
    The protocol fees are claimed along the period rewards. In the case where the Staking contract has less than the calculated protocol fees for the current period, the Staking contract obtains the extra needed amount from a new SafeBoxBuffer contract. Whereas, if the Staking contract to has more than the calculated protocol fees for the current period, the Staking contract stores the extra amount in the SafeBoxBuffer contract.

Note: the time between the staking period being closed and the stakers being able to claim the rewards depends on the execution time of all 3 steps. This can range from 30 minutes to 1 hour.

Test Cases

Test Case A

Stake with the same amount with two stakers on two different chains. The received rewards should be equal.

Implementation

  • Collector contract - perform cross-chain updates in the Staking contract
  • SafeBoxBuffer contract - provide/store protocol extra fees amount for each staking period.

Copyright

Copyright and related rights waived via CC0.