> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inkyswap.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ABI

> Function signatures, event topics, and call data for the InkyPump V2 hook.

This page lists the public surface of the InkyPump V2 hook at `0x4cC8F6d5B7cE150CCC0A9B7664532B1283b96AC4`. Signatures match the deployed implementation.

## Write functions

```solidity theme={null}
function createLaunch(InkyPumpTypes.CreateLaunchParams calldata params)
    external payable returns (uint256 launchId);

function createLaunchWithReferral(
    InkyPumpTypes.CreateLaunchParams calldata params,
    string calldata referralCode
) external payable returns (uint256 launchId);

function buy(
    uint256 launchId,
    uint256 minTokensOut,
    InkyPumpTypes.CaptchaAuth calldata captcha
) external payable returns (uint256 tokensOut);

function buyWithReferral(
    uint256 launchId,
    uint256 minTokensOut,
    InkyPumpTypes.CaptchaAuth calldata captcha,
    string calldata referralCode
) external payable returns (uint256 tokensOut);

function sell(
    uint256 launchId,
    uint128 tokenAmount,
    uint256 minEthOut,
    InkyPumpTypes.CaptchaAuth calldata captcha
) external returns (uint256 payout);

function sellWithReferral(
    uint256 launchId,
    uint128 tokenAmount,
    uint256 minEthOut,
    InkyPumpTypes.CaptchaAuth calldata captcha,
    string calldata referralCode
) external returns (uint256 payout);

function updateCreatorFeeSplit(uint256 launchId, uint16 newSplitBps) external;

function withdrawFees() external;

function executeAccumulatedBuyback(uint256 launchId) external;
```

## Read functions

### On the hook (`0x4cC8F6d5B7cE150CCC0A9B7664532B1283b96AC4`)

```solidity theme={null}
function getLaunchState(uint256 launchId)
    external view returns (InkyPumpTypes.LaunchConfig memory);

function withdrawableFees(address account) external view returns (uint256);

function accumulatedBuyback(uint256 launchId) external view returns (uint256);

function viewer() external view returns (address);
function tradingModule() external view returns (address);
```

### On `LaunchViewModule` (`0xce83E3659251116d114Ec1CA729ffB49B99403c3`)

The hook also has `previewBuy(uint256,uint256)` and `previewSell(uint256,uint128)` wrappers that delegate to the configured viewer contract. Use the view module functions below directly for the working preview path. See [Quotes](/api-reference/contracts/quotes) for the full pattern.

```solidity theme={null}
function previewBuyLocal(
    uint128 saleSupply,
    uint96 targetRaise,
    uint32 gainBps,
    uint128 sold,
    uint128 remaining,
    uint256 ethIn
) external pure returns (
    uint256 tokensOut,
    uint256 cost,
    uint256 refund,
    uint256 tokensRemaining
);

function previewSellLocal(
    uint128 saleSupply,
    uint96 targetRaise,
    uint32 gainBps,
    uint128 sold,
    uint128 tokenAmount,
    uint128 netContributions,
    uint16 creatorFeeSplitBps,
    uint16 protocolFeeBps,
    uint16 variableFeeBps,
    uint16 bpsDenominator
) external pure returns (
    uint256 netPayout,
    uint256 protocolFee,
    uint256 creatorFee,
    uint256 buybackFee
);

function previewSaleSplit(uint96 targetRaise, uint32 gainBps)
    external view returns (
        uint128 saleSupply,
        uint128 liquiditySupply,
        uint16 salePortionBps,
        uint256 marginalPrice,
        uint256 poolPrice
    );
```

## Events

```solidity theme={null}
event LaunchCreated(
    uint256 indexed launchId,
    address indexed creator,
    address token,
    uint96 targetRaise
);

event LaunchMetadata(
    uint256 indexed launchId,
    string name,
    string ticker,
    string description,
    string imageUrl,
    string telegram,
    string twitter,
    string website
);

event Trade(
    uint256 indexed launchId,
    address indexed trader,
    TradeType tradeType,
    PriceData priceData,
    TradeData tradeData,
    uint256 refund
);

event Referral(
    uint256 indexed launchId,
    address indexed trader,
    string referralCode
);

event LaunchFinalized(
    uint256 indexed launchId,
    PoolId poolId,
    uint256 liquidityEth,
    uint256 liquidityTokens
);

event BuybackExecuted(
    uint256 indexed launchId,
    uint128 tokensBurned,
    uint256 ethSpent
);

event CreatorFeeSplitUpdated(uint256 indexed launchId, uint16 splitBps);

event SalePortionResolved(
    uint256 indexed launchId,
    uint16 salePortionBps,
    uint256 marginalPrice,
    uint256 poolPrice
);

event FeeAccrued(address indexed recipient, uint256 amount);
event FeeWithdrawn(address indexed recipient, uint256 amount);
```

## Event topic hashes

For direct log subscription, these are the topic hashes (keccak256 of the canonical signature):

| Event                              | Topic hash                                                           |
| ---------------------------------- | -------------------------------------------------------------------- |
| `Referral(uint256,address,string)` | `0x796dfbc4bdc1de15340f520a4b17fb287a10b2f6c50e702ee8dc9fa2c714dfc5` |

Other topic hashes can be computed locally with `cast keccak256 "EventName(args)"`.

## Struct shapes

```solidity theme={null}
struct CreateLaunchParams {
    string name;
    string ticker;
    string description;
    string imageUrl;
    string telegram;
    string twitter;
    string website;
    uint16 creatorFeeSplitBps; // 0 to 10000
    uint32 gainBps;            // 0 to 200000 (1x to 21x)
    uint96 targetRaise;        // 1 to 5 ether
    uint32 antiSnipeDuration;  // 0, 20, 40, or 60 seconds (UI restricted)
    uint64 startTime;          // 0 for immediate, future timestamp for scheduled
}

// Note: there is no `prebuyEth` field. To prebuy at launch, send the prebuy amount
// as `msg.value` on the `createLaunch` call.

struct CaptchaAuth {
    uint256 deadline;
    bytes signature;
}

struct LaunchConfig {
    // see InkyPumpTypes.sol for the full layout
    uint64 launchTimestamp;
    uint32 antiSnipeDuration;
    uint16 creatorFeeSplitBps;
    // ... other fields including the token address, finalized flag, etc.
}
```

For the full struct definitions in source, see `pump-contracts-v2/src/libraries/InkyPumpTypes.sol`.
