# memez\_pump

<mark style="color:yellow;">new -</mark> creates a new pump pool using the `ConfigKey` settings.

```rust
public fun new<Meme, Quote, ConfigKey, MigrationWitness>(
    config: &MemezConfig,
    meme_treasury_cap: TreasuryCap<Meme>,
    mut creation_fee: Coin<SUI>,
    pump_config: PumpConfig,
    first_purchase: Coin<Quote>,
    metadata: MemezMetadata,
    stake_holders: vector<address>,
    is_protected: bool,
    dev: address,
    allowed_versions: AllowedVersions,
    ctx: &mut TxContext,
): (MemezFun<Pump, Meme, Quote>, MetadataCap)
```

**Arguments:**

* **`config: &MemezConfig`**\
  The Memez [config shared object](https://suiscan.xyz/mainnet/object/0x9c665993f61a902475b083036da75240aa203bb874ebce4031810b589e485a61/tx-blocks).&#x20;
* **`meme_treasury_cap: TreasuryCap<Meme>`**\
  The treasury cap for the meme coin (`memeCoinTreasuryCap`), which represents the authority or capability to mint and manage supply for the meme coin.
* **`mut creation_fee: Coin<SUI>`**\
  The SUI fee used during creation of the pool (`creationSuiFee`). This coin will be consumed as part of the transaction costs.
* **`pump_config: PumpConfig`**\
  Configuration for the pump invariant logic — this may include values like `burnTax`, `virtualLiquidity`, `targetQuoteLiquidity`, and `liquidityProvision`.
* **`first_purchase: Coin<Quote>`**\
  A coin of the quote asset used for the first purchase in the pool (`firstPurchase`).&#x20;
* **`metadata: MemezMetadata`**\
  Arbitrary metadata associated with the meme coin (`metadata`). This may include things like creator address, X, description, and social links.
* **`stake_holders: vector<address>`**\
  A list of addresses representing the stakeholders of the meme coin. These might be early backers, team members, or governance participants. The numebr of stake\_holders depending on the configuration set by the admin.
* **`is_protected: bool`**\
  A flag that indicates whether transactions require backend signatures to process pump operations (`isProtected`). Helps prevent abuse.
* **`dev: address`**\
  The developer’s address (`developer`). This address may be eligible for future fee distributions or administrative rights.
* **`allowed_versions: AllowedVersions`**\
  A witness to ensure that the package version is up to date.
* **`ctx: &mut TxContext`**\
  A mutable reference to the transaction context provided by Sui.

<mark style="color:yellow;">pump -</mark> allows the user to buy meme coins from the pool.

```rust
public fun pump<Meme, Quote>(
    self: &mut MemezFun<Pump, Meme, Quote>,
    quote_coin: Coin<Quote>,
    referrer: Option<address>,
    signature: Option<vector<u8>>,
    min_amount_out: u64,
    allowed_versions: AllowedVersions,
    ctx: &mut TxContext,
): Coin<Meme> 
```

**Arguments:**

* **`self: &mut MemezFun<Pump, Meme, Quote>`**\
  A mutable reference to the `MemezPool` (specifically using the Pump invariant) — this is the pool that facilitates the trade.
* **`quote_coin: Coin<Quote>`**\
  The quote coin provided by the user to be exchanged for meme coin.
* **`referrer: Option<address>`**\
  An optional address of the referrer who may be eligible for referral rewards.
* **`signature: Option<vector<u8>>`**\
  An optional server-provided signature. This is **required** if the pool is marked as protected.
* **`min_amount_out: u64`**\
  The minimum amount of meme coin that the user expects to receive from the trade.\
  This prevents slippage or front-running attacks.
* **`allowed_versions: AllowedVersions`**\
  A witness to ensure that the package version being used is current and authorized.
* **`ctx: &mut TxContext`**\
  A mutable reference to the Sui transaction context.&#x20;

<mark style="color:yellow;">dump -</mark> allows the user to sell meme coins.

```rust
public fun dump<Meme, Quote>(
    self: &mut MemezFun<Pump, Meme, Quote>,
    treasury_cap: &mut IPXTreasuryStandard,
    meme_coin: Coin<Meme>,
    referrer: Option<address>,
    min_amount_out: u64,
    allowed_versions: AllowedVersions,
    ctx: &mut TxContext,
): Coin<Quote>
```

**Arguments:**

* **`self: &mut MemezFun<Pump, Meme, Quote>`**\
  A mutable reference to the MemezPool that uses the Pump invariant — this is the pool from which the meme coin will be sold.
* **`treasury_cap: &mut IPXTreasuryStandard`**\
  A mutable reference to the shared ipx treasury cap, used to authorize burns.
* **`meme_coin: Coin<Meme>`**\
  The meme coin being sold in exchange for quote (e.g., SUI).
* **`referrer: Option<address>`**\
  An optional referrer address to credit for referral rewards.\
  \&#xNAN;*(Corresponds to `referrer` in the client — can be null.)*
* **`min_amount_out: u64`**\
  The minimum amount of quote coin (e.g., SUI) the user expects to receive in return.\
  Protects against slippage or unfavorable trades.
* **`allowed_versions: AllowedVersions`**\
  A witness object ensuring the transaction uses an allowed and up-to-date package version.
* **`ctx: &mut TxContext`**\
  A mutable reference to the transaction context provided by the Sui blockchain.&#x20;

<mark style="color:yellow;">migrate -</mark> it migrates a pool to a DEX. The functions returns a hot potato that can only be destroyed by using an authorized migration witness.

```rust
public fun migrate<Meme, Quote>(
    self: &mut MemezFun<Pump, Meme, Quote>,
    allowed_versions: AllowedVersions,
    ctx: &mut TxContext,
): MemezMigrator<Meme, Quote>
```

**Arguments:**

* **`self: &mut MemezFun<Pump, Meme, Quote>`**\
  A mutable reference to the Memez pool that uses the Pump invariant — this is the pool being migrated.
* **`allowed_versions: AllowedVersions`**\
  A witness object ensuring the migration call is executed only if the contract package version is valid and up-to-date.
* **`ctx: &mut TxContext`**\
  A mutable reference to the transaction context provided by the Sui blockchain. Required for creating, transferring, and managing objects during migration.

<mark style="color:yellow;">dev\_purchase\_claim -</mark> allows the developer to claim the meme coins bought in the first purchase.

```rust
public fun dev_purchase_claim<Meme, Quote>(
    self: &mut MemezFun<Pump, Meme, Quote>,
    allowed_versions: AllowedVersions,
    ctx: &mut TxContext,
): Coin<Meme>
```

**Arguments:**

* **`self: &mut MemezFun<Pump, Meme, Quote>`**\
  A mutable reference to the Memez pool that uses the Pump invariant — this returns the developer first purchase.
* **`allowed_versions: AllowedVersions`**\
  A witness object ensuring the migration call is executed only if the contract package version is valid and up-to-date.
* **`ctx: &mut TxContext`**\
  A mutable reference to the transaction context provided by the Sui blockchain. Required for creating, transferring, and managing objects during migration.

<mark style="color:yellow;">distribute\_stake\_holders\_allocation -</mark> allows anyone to distribute the meme coin allocations to its respective recipients. It can only be done after a pool has been migrated.

```rust
public fun distribute_stake_holders_allocation<Meme, Quote>(
    self: &mut MemezFun<Pump, Meme, Quote>,
    clock: &Clock,
    allowed_versions: AllowedVersions,
    ctx: &mut TxContext,
)
```

**Arguments:**

* **`self: &mut MemezFun<Pump, Meme, Quote>`**\
  A mutable reference to the Memez pool that uses the Pump invariant — this returns the developer first purchase.
* **`clock: &Clock`**\
  The Clock shared object.
* **`allowed_versions: AllowedVersions`**\
  A witness object ensuring the migration call is executed only if the contract package version is valid and up-to-date.
* **`ctx: &mut TxContext`**\
  A mutable reference to the transaction context provided by the Sui blockchain. Required for creating, transferring, and managing objects during migration.

<mark style="color:yellow;">quote\_pump -</mark> quotes the current exchange rate between quote coin for meme coin.

```rust
public fun quote_pump<Meme, Quote>(
    self: &mut MemezFun<Pump, Meme, Quote>,
    amount_in: u64,
): vector<u64>
```

**Arguments:**

* **`self: &mut MemezFun<Pump, Meme, Quote>`**\
  A mutable reference to the Memez pool that uses the Pump invariant — this is the pool being queried for a pricing quote.
* **`amount_in: u64`**\
  The input trade size of the meme coin, expressed in its smallest unit.\
  Used to calculate how much of the quote asset (e.g., SUI) would be received under the Pump invariant.

<mark style="color:yellow;">quote\_dump -</mark> quotes the current exchange rate between meme coin for the quote coin.

```rust
public fun quote_dump<Meme, Quote>(
    self: &mut MemezFun<Pump, Meme, Quote>,
    amount_in: u64,
): vector<u64>
```

**Arguments:**

* **`self: &mut MemezFun<Pump, Meme, Quote>`**\
  A mutable reference to the Memez pool that uses the Pump invariant — this is the pool being queried for a pricing quote.
* **`amount_in: u64`**\
  The input trade size of the **quote coin** (e.g., SUI), expressed in its smallest unit.\
  Used to calculate how much of the meme coin would be received when “dumping” quote into the pool.
