Collective: Cross Chain Savings

What is Collective?

Collective is a cross-chain smart contract-powered savings application built with Chainlink CCIP. It enables users to participate in savings across supported chains and enjoy the advantages of being cross-chain compatible.

The key features of the application include cross-chain interoperability, a unique interest generation process, seamless distribution, and comprehensive status handling. Currently deployed on the testnets of Optimism, Avalanche, and Polygon.

Why Collective?

In response to the growing demand for cross-chain applications, Collective leverages cross-chain capabilities to capture actual yield for users, avoiding confinement to a single chain.

Collective implements a realistic approach to interest generation, utilizing a cross-chain pool to share interest. Users adhering to their long-term savings goals and achieving their targets are eligible to earn interest from the pool. The longer the save time, the greater the share in the pool. Users opting out of their savings early incur a percentage fee, which contributes to the cross-chain pool for other savers.

This concept encourages users to stick to their savings goals. Failure to do so results in a penalty (slashing), with the fee going into the pool to incentivize other users who successfully complete their saving time and target.

A good example would be four friends: Jake, John, Alice, and Patrick, all saving on Collective.

  • John saves on the Polygon chain.
  • Jake saves on the Avalanche chain.
  • Alice and Patrick both save on Optimism.

Now, if Alice and Jake were to break their savings early for various reasons:

  • If John and Patrick successfully complete their savings, it doesn't matter if they saved on the chain where the breaking of the savings occurred. They are eligible to receive the interest generated from those users in the pool.

Awesome, right? I know! 😄

Concepts Explained

Total Collective Interest

The total interest generated by all defaulters across chains, measured in USDT.

Total Savers

The total number of unique savers across chains.

Total Expected Save Time

The combined expected save time for all prospective savers who complete their savings period.

Protocol Profit

The profit earned by the protocol from savers who fail to meet their group savings target.

USDT Balances For Each Chain

Displays USDT balances for each chain deposited by cosmic providers, incremented by defaulters or withdrawn by savers.

Individual Savings

Users can initiate savings by setting a cross-chain saving target amount, duration, reason, and initial save amount. Continuous top-ups across chains are required to fulfill the target before the saving period elapses. After completion, a cross-chain call releases all funds, providing interest based on a time-based formula.

Group Savings

Similar to individual savings, but with multiple contributors aiming for a shared target. Contributors can reclaim individual contributions with a fee if the group fails to reach the target.

Cosmic Providers

Providers deposit USDT into contracts, earning IOU-USDT equivalents, which can be redeemed on any chain after an unlock period.

How We Used Chainlink, Other Tools & Accomplishments

  1. We utilized Chainlink CCIP for cross-chain transactions.
  2. Chainlink price feeds facilitated automatic swaps and interest calculations.
  3. We created CCIP mocks that we used for local testing.
  4. We employed what we refer to as execution paths to map out function-to-function calls across chains. For instance, a "start saving" execution path would understand that the cross-chain message, when received on another chain, is meant to handle the execution of starting a savings process.
  5. Foundry supported testing, scripting, and deployment.
  6. Next.js and Wagmi were used for the frontend.
  7. The application was developed solo.

Links

Little Extra Notes

Late bug finder:

  • On the frontend, when making transactions requiring approval, re-input the amount after initiating approval. The previous amount was for approval else metamask wont pop up. Cheers! 😄

Built With

Share this project:

Updates