8000 GitHub - usecorn/popcorn
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

usecorn/popcorn

Repository files navigation

🍿 popCORN: A Vesting Token Wrapper for CORN

Overview

popCORN is a vesting token wrapper for the CORN token. This repository contains the contracts that implement the vesting functionality, allowing CORN tokens to be distributed with a vesting schedule that encourages long-term holding while still offering immediate liquidity to users.

This codebase is forked and modified from the Euler Vault Kit Periphery by Euler Labs Ltd. We extend our gratitude to the Euler team for their original implementation of the reward token vesting mechanism. The core ERC20WrapperLocked contract has been adapted from Euler's rEUL token implementation to fit Corn's needs.

Key Features

  • Vesting Schedule: When users claim CORN rewards, they receive popCORN

    • 21% of rewards are immediately withdrawable
    • 79% vest linearly over 21 weeks
    • Early withdrawal forfeits unvested tokens
  • Non-transferable: popCORN tokens cannot be transferred or traded

  • Forfeited Rewards: Unvested tokens that are withdrawn early are returned to the treasury to be reused for incentives

Contracts

ERC20WrapperLocked

The core contract that implements the vesting wrapper functionality. It wraps CORN tokens with a vesting schedule, providing methods to:

  • Query locked positions and vesting progress
  • Withdraw vested tokens
  • Track vesting status across multiple positions

RewardToken

An implementation of ERC20WrapperLocked that adds Corn-specific configuration:

  • Immediate unlock share: 21%
  • Linear unlock share: 79%
  • Vesting duration: 147 days (21 weeks)

Contract Functions

Viewing Vesting Positions

getLockedAmounts(address account): Returns two arrays containing the lock timestamps and amounts

getLockedAmountsWithClaimable(address account): Returns three arrays - lock timestamps, total amounts, and currently claimable amounts

getWithdrawAmountsByLockTimestamp(address account, uint256 lockTimestamp): Returns how much can be claimed and how much would be forfeited for a specific locked position

Withdrawing Tokens

withdrawToByLockTimestamp(address account, uint256 lockTimestamp, bool allowRemainderLoss): Withdraws a specific locked position. If allowRemainderLoss is false, the transaction will revert if there are any unvested tokens.

withdrawToByLockTimestamps(address account, uint256[] lockTimestamps, bool allowRemainderLoss): Withdraws multiple locked positions in a single transaction.

Integration with Merkl

popCORN is integrated with Merkl for distributing rewards to users of apps on the Corn network:

  1. Users interact with apps on Corn Network
  2. Rewards are calculated off-chain through Merkl
  3. Users claim their rewards through the Corn app's interface
  4. When claimed, rewards are issued as popCORN with the vesting schedule applied

Security

This software is based on a production-ready implementation but has been modified for Corn's specific needs. While the core vesting mechanism 60E3 has been proven in production, any modifications should be considered with appropriate caution.

A comprehensive security audit is recommended before deployment to production.

Safety

This software is experimental and is provided "as is" and "as available". No warranties are provided and no liability will be accepted for any loss incurred through the use of this codebase. Always include thorough tests when using EVK Periphery to ensure it interacts correctly with your code.

License

(c) 2024 Corn Finance Originally derived from Euler Labs Ltd. code under GPL-2.0-or-later license. The popCORN code is licensed under the GPL-2.0-or-later license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0