- It’s an ERC20 token inheriting from OpenZeppelin’s standard ERC20 implementation.
- All tokens are minted to the contract’s own address when it is deployed.
- 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. - 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. - Decimals are set to 6 (like USDT), rather than the usual 18 for ERC20.
- 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.
- 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.
function distributeTokens(address to, uint256 amount) external onlyOwner {
// ...
}
distributeTokens(...)
is called by the owner (the contract’sOwnable
).- It moves all tokens out of the contract and into the specified
to
address in one go. - The function requires that:
- The contract has never performed this distribution before (
require(!distributed, ...)
). - The
to
address is not0x0
. - The
amount
must match the entire balance the contract currently holds.
- The contract has never performed this distribution before (
- After it executes successfully, it marks
distributed = true
, ensuring no further distributions can happen.
- 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.
The contract has four immutable parameters:
B
(base price scale)L
(early-phase sensitivity)E
(exponential steepness)T
(transition supply, computed asL * (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.
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.
- It inherits OpenZeppelin’s
Ownable
with a constructor parameterinitialOwner
. - The
onlyOwner
modifier ondistributeTokens(...)
ensures only the contract’s designated owner can trigger the single distribution.
-
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.
- The deployer specifies the token name, symbol, total supply, and the bonding curve parameters
-
(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.
- If the contract’s
-
(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 totrue
, preventing further distributions.
-
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).
- 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.