Git Product home page Git Product logo

mx-metabonding-sc's Introduction

Metabonding

Introduction

The metabonding smart contract is meant to give additional incentives to users to stake their tokens, specifically EGLD and LKMEX (Locked MEX). Each user that has some tokens staked will receive rewards based on how much they contribute to the specific staking pool.

This can act as either a launchpad for new projects, or just as an additional reward pool for stakers.

Adding projects

Projects can only be added by the contract owner. Each project has:

  • a unique ID of maximum 10 characters (bytes)
  • an owner - will receive any leftover tokens once the project is cleared
  • a reward token
  • a total reward token supply
  • a start week
  • a duration in weeks
  • a percentage of how much of the rewards is distributed to LKMEX stakers (the rest will be distributed to EGLD stakers)

Projects can also be removed by the owner if deemed necessary. All leftover funds will be returned to the project owner in such a scenario.

A project is not considered "active" until all reward tokens have been deposited.

Rewards distribution

Rewards are distributed on a weekly basis. For example, if a project has a 4 week duration, then 25% of the rewards will be distributed each week. From this 25%, a part will be distributed to EGLD stakers, and a part to LKMEX stakers. This depends on the percentage given at the project's initialization.

The owner will add weekly checkpoints, which will describe the total staking pool for both EGLD and LKMEX.

Distribution is not done automatically. Each user will have to claim their own rewards. They can do so until the project is expired, which is currently set to one week after its end.

Since the metabonding SC does not have access to the staking pool's information, it will receive these informations from the users when they claim. These are checked against a signature provided by the owner (or another designated signer address). The current implementation works like this:

  • owner checks the staking pools, and gets the total amounts, then creates the checkpoint for the current week with those values
  • owner checks the specific values for users, then the signature is given by sign_ed25519(week_number + user_address + user_egld_staked_amount + user_lkmex_staked_amount). This is signed using the signer's secret key
  • the user claims rewards, by giving the week number, user_egld_staked_amount, user_lkmex_staked_amount and the signature as arguments.
  • the metabonding SC verifies the signature, and gives the user their share of the rewards
  • the SC marks the rewards as claimed for the given week for the current user

Rewards formula

The weekly reward formula is as follows:

Note: Percentages are considered to be in range [0, 100] in this example.

total_weekly_reward = project_reward_supply / project_duration_weeks weekly_reward_lkmex = total_weekly_reward * lkmex_reward_percentage / 100
weekly_reward_egld = total_weekly_reward - weekly_reward_lkmex

user_weekly_reward_for_lkmex = weekly_reward_lkmex * user_lkmex_staked / total_lkmex_staked
user_weekly_reward_for_egld = weekly_reward_egld * user_egld_staked / total_egld_staked

user_weekly_reward = user_weekly_reward_for_lkmex + user_weekly_reward_for_egld

mx-metabonding-sc's People

Contributors

dorin-iancu avatar costincarabas avatar psorinionut avatar andreibancioiu avatar claudiu725 avatar ccorcoveanu avatar andrei-marinica avatar

Stargazers

Cioclea Doru Octavian avatar Alexandru Pislariu avatar

Watchers

Felix avatar Robert Sasu avatar  avatar Alin Cruceat avatar  avatar Laurentiu Ciobanu avatar Claudiu Lataretu avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.