Skip to content

Bonding-Labs/MemeCoin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

  1. It’s an ERC20 token inheriting from OpenZeppelin’s standard ERC20 implementation.
  2. All tokens are minted to the contract’s own address when it is deployed.
  3. There is only one function (distributeTokens(...)) that can transfer these tokens from the contract to a real address—and it can only be called once.
  4. It includes bonding curve parameters (B, L, E, T) in the token contract, but the token contract itself doesn’t perform the bonding curve logic; that typically happens in an external exchange contract. The parameters just store the values needed for that formula.
  5. Decimals are set to 6 (like USDT), rather than the usual 18 for ERC20.

Purpose and Mechanics

1. Minting the Tokens to the Contract Itself

  • In the constructor, _mint(address(this), totalSupply_) mints the entire token supply directly into the contract’s own balance.
  • This means initially nobody (no external user) has any tokens except this MemeCoin contract itself.

Why Do That?

  • The idea is to lock the tokens within the contract at creation, preventing any distribution or partial early transfer.
  • This approach is often used to ensure a “fair launch” or to enforce an “all-or-nothing” release of tokens.

2. Single Distribute Function

function distributeTokens(address to, uint256 amount) external onlyOwner {
    // ...
}
  • distributeTokens(...) is called by the owner (the contract’s Ownable).
  • It moves all tokens out of the contract and into the specified to address in one go.
  • The function requires that:
    1. The contract has never performed this distribution before (require(!distributed, ...)).
    2. The to address is not 0x0.
    3. The amount must match the entire balance the contract currently holds.
  • After it executes successfully, it marks distributed = true, ensuring no further distributions can happen.

Why a Single Distribution?

  • This pattern enforces that there’s exactly one moment in time when the full token supply leaves the contract.
  • The developer cannot do multiple partial sends from the contract’s stash. This is effectively a guard against extended “rugpull” scenarios or undisclosed reserves of tokens.

3. Bonding Curve Parameters

The contract has four immutable parameters:

  • B (base price scale)
  • L (early-phase sensitivity)
  • E (exponential steepness)
  • T (transition supply, computed as L * (e - 1))

Although these parameters live in the MemeCoin contract, the token itself doesn’t do the bonding curve math. Typically, an external “HybridExchange” or “AMM” contract references these parameters (B(), L(), etc.) to figure out the current price or expected output in a buy/sell transaction.

4. Decimals: 6

function decimals() public pure override returns (uint8) {
    return 6;
}
  • It overrides the standard 18 decimals from ERC20 and sets it to 6, reminiscent of how stablecoins like USDT operate.
  • This is just a design choice to keep the token’s “display units” consistent with stablecoins.

5. Ownership and Access

  • It inherits OpenZeppelin’s Ownable with a constructor parameter initialOwner.
  • The onlyOwner modifier on distributeTokens(...) ensures only the contract’s designated owner can trigger the single distribution.

Typical Usage Flow

  1. Deployment

    • The deployer specifies the token name, symbol, total supply, and the bonding curve parameters B, L, E, plus an owner address.
    • All tokens are minted into the contract’s own address.
  2. (Optionally) No One Calls distributeTokens(...)

    • If the contract’s distributeTokens(...) is never called, the tokens remain locked forever in the MemeCoin contract’s balance.
    • This effectively means no token can be traded or used.
  3. (Usually) The Owner Calls distributeTokens(...) Exactly Once

    • The entire balance goes to some external address, which might be a factory or exchange or a user.
    • After that, distributed is set to true, preventing further distributions.
  4. Once Distributed

    • The receiving address can then do whatever it wants with the tokens (e.g., provide them to an exchange contract, allocate them to users, or distribute them for liquidity).

Why It’s “Special”

  • It avoids partial distributions by only allowing a single, all-or-none distribution event.
  • The approach is pitched as fair or rugpull-resistant because once the tokens are distributed, the contract can no longer drip out extra hidden tokens from an unexposed stash.
  • The presence of bonding curve parameters in the MemeCoin is a sign that it’s meant to integrate with a specialized hybrid AMM which uses these parameters in pricing logic (like “HybridExchange”).

In short, MemeCoin is an ERC20 token contract designed to do exactly one big “unlock” of tokens for fair launch scenarios, plus it stores parameter data for an external bonding curve-based exchange.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published