This repository holds the code for MAGA $MILEI smart contracts.
npm run test
npm run test:report-gas
Running tests in VS Code: https://hardhat.org/hardhat-runner/docs/advanced/vscode-tests
Deploy to a local Hardhat node.
npm run compile
npm run node
npm run deploy:local
npm install --save-dev hardhat
npx hardhat
npx hardhat compile
MAGA MILEI employs advanced mathematical principles for its tokenomics, ensuring equitable distribution of rewards among all token holders without necessitating token transfers. Utilizing the reflection
mechanism, MAGA MILEI dynamically adjusts rewards
with each transaction, maintaining a fair distribution model.
Distinctively, it abstains from employing mint
and burn
methods for token generation or reduction, setting its initial supply at 512 Quadrillion tokens upon deployment.
Despite the fixed supply, MAGA MILEI's token count may increase over time due to reward distributions. These rewards are minted dynamically as transactions occur, facilitated by the reflection
mechanism.
Additionally, users can effectively burn their tokens by transferring them to the liquidity pool
, although without a designated burn
function. This mechanism contributes to liquidity while potentially reducing the token supply.
Following each transaction, a portion of tokens is burned as a liquidity fee
, while another portion is minted as rewards
, all orchestrated through the reflection mechanism.
IERC20
interface: Used for ERC-20 tokens.SafeMath
library: Ensures safe arithmetic operations.abstract
contractContext
: Retrieves "msg.sender" and "msg.data".Address
library: Contains functions related to address types.Ownable
contract inherits fromContext
: Manages owner-related operations such astransferOwnership
,onlyOwner
,owner
, etc.IUniswapV2Factory
interface: Creates liquidity pairs with "MAGA MILEI and WBNB".IUniswapV2Pair
interface: Not utilized in MAGA MILEI, but serves as the template for creating new liquidity pairs.IUniswapV2Router01
interface: Facilitates the use of the Uniswap functionaddLiquidityETH
.IUniswapV2Router02
is a refinement ofIUniswapV2Router01
: Used for the Uniswap functionswapExactTokensForETHSupportingFeeOnTransferTokens
.contract CoinToken is Context, IERC20, Ownable
contract inherits fromContext
,IERC20
,Ownable
: This contract implements the MAGA MILEI tokenomics.
To understand the MAGA MILEI project, it is essential to grasp the fundamentals of PancakeSwap (or Uniswap). This repository provides comprehensive explanations of PancakeSwap concepts, along with additional resources for deeper understanding.
This section covers the following topics (Link):
- Centralized Exchange (CEX) and Decentralized Exchange (DEX)
- Market Maker
- Automated Market Maker (AMM)
- Constant Product Formula
$( k = x \times y )$ - PancakeSwap V2 Main Features
- Token Swap
- Liquidity Provisioning
- Providing two tokens to mint LP token
- Staking LP token
- Unstaking LP token
- Burning LP token back to two tokens
- Oracle
- Flash Loans
PancakeSwap's architecture comprises two main repositories, each containing two primary smart contracts:
-
Core: Responsible for storing values (tokens) and managing them.
- Pair: Implements functionality for swapping, minting, and burning tokens.
- Factory: Facilitates the creation and tracking of pairs.
-
Periphery: Contains smart contracts that interact with the Core.
- Router: Facilitates interactions with the Core, providing functionalities such as
swapETHForExactTokens
,swapExactETHForTokens
, etc. - Library: Provides functionalities like
getReserves
,getAmountIn
,getAmountOut
, etc.
- Router: Facilitates interactions with the Core, providing functionalities such as
This section elaborates on the following topics (Link):
- Pair
- Mint
- FeeOn and mintFee
- Burn
- Swap
- Swapping Fee