Code Monkey home page Code Monkey logo

moe-core's Introduction

This repository contains the contracts, tests and deploy scripts for the Moe protocol.

Contracts

The Moe contract is the governance token of the protocol. It is a standard ERC20 token where only the minter can mint tokens up to the maximum supply, which is set at 500M MOE. The distribution of the tokens is as follows:

  • 15% to seed investors, using vesting contracts. (pre-minted)
  • 15% to future investors, using vesting contracts. (pre-minted)
  • 15% to the team, using vesting contracts. (pre-minted)
  • 2.5% to Joe stakers as an airdrop, distributed at the start of the protocol. (pre-minted)
  • 5% to Joe stakers, distributed over 1 year. (pre-minted)
  • 30% to liquidity mining incentives, distributed over 4 years. (emissions)
  • 17.5% to the treasury, distributed over 4 years. (emissions)

The different vesting contracts all starts 8 months after the TGE and are vesting linearly over 40 months. Additionally, there will be a 4 months cliff preventing any tokens to be withdrawn before the first year.

Tokenomics

The MasterChef contract is the only contract that can mint MOE tokens. It will be used to distribute the liquidity mining rewards to the farms. Users can stake their LP tokens to earn MOE rewards. The rewards are distributed based on the votes in the VeMoe contract. Admins can open farms, update the MOE per second and add extra rewarders to the farms. They can also update the treasury address.

The MasterChefRewarder contract is the rewarder that will be used on top of the MasterChef contract to distribute extra rewards to the farms. Only the MasterChef contract can call onModify to update the user's rewards. Admins can set the start, end and extra reward per second. The adminds can also sweep any non active reward tokens.

The MoeStaking contract is the staking contract for the MOE token. Users can stake their MOE tokens to receive veMOE tokens and rewards from sMoe.

The StableMoe contract will distribute the protocol fees from the dex to the MOE stakers. They are firstly converted to a single reward token (most liely a stablecoin) and then distributed to the stakers. Users can call claim to get their rewards. Admins can add/remove rewards (each token can be added only once, removal is permanent) and sweep any non active reward tokens.

The VeMoe contract is the vesting escrow contract for the veMOE tokens. The veMOE tokens are non-transferable and can be used to vote on pools to increase their weight. If user wants to unstake from MoeStaking, they need to have 0 votes on pools and will loose their entire veMOE balance. The weight will be used to calculate the share of the MOE rewards going to that pool in the MasterChef. To avoid gas issues, only pools that are in the top pools list will receive rewards. This list will be updated every week or so. Anyone can create a bribe pool to incentivize people to vote on a pool. After having voted, users can select to which bribes they want to receive rewards from (only one per pool id). Admins can set the top pools ids and the veMOE per second per MOE ratio.

The VeMoeRewarder contract is the rewarder that should be used for bribes pool to distribute rewards to voters of a pool. Only the VeMoe contract can call onModify to update the user's rewards.

The BaseRewarder contract is the base contract for the rewarders. It is used by the VeMoeRewarder and MasterChefRewarder contracts.

The dex contracts are a fork of Uniswap v2 with some modifications:

  • bump solidity version from 0.5.16 to 0.8.20
  • pairs are deployed as immutable clones instead of redeploying the entire pair. This will greatly reduce the gas cost of creating pairs.
  • instead of minting protocol fees as LP tokens, they are directly sent to the feeTo address. This will reduce the gas cost of SMoe conversion and increase the rewards by summing the fees from all pairs.

Order of operations

  1. Fill and verify the parameters.
  2. Deploy the Moe protocol contracts using the protocol script.
  3. Deploy the dex contracts using the dex script.
  4. Set the beneficiary addresses on the different vesting contracts
  5. Create default pools and farms.
  6. Set the veMoePerSecPerMoe on the VeMoe contract to start the veMOE distribution.
  7. Once there is some votes on the top pools, set the moePerSec on the MasterChef contract to start the MOE distribution.

Foundry

This repository uses Foundry. The documentation can be found here.

Build

To build the contracts, run:

$ forge build

Test

To run the tests, run:

$ forge test

Deploy

To deploy the contract, copy the .env.example to .env and fill in the values. Then run:

$ forge script script/<name_of_the_script> --broadcast --verify

moe-core's People

Contributors

0x0louis avatar

Stargazers

 avatar Tim Kabael avatar JC avatar  avatar ladboy233 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.