NYYU Logo
APIPresale

Create New Presale

Admin mutation to create new presale rounds with token amounts, prices, and conditions

ADMIN ONLY

Create New Presale Round

Launch new presale rounds with customizable token amounts, pricing, and conditions for your token sale events.

Admin Access Required

This mutation is only accessible to users with ADMIN privileges. Standard users cannot create presale rounds.

Overview

The createNewPresale mutation enables administrators to launch new presale rounds with complete control over timing, token allocation, pricing, and custom conditions.


GraphQL Schema

mutation {
  createNewPresale(
    startedAt: Float!
    endedAt: Float!
    tokenAmount: Float!
    tokenPrice: Float!
    conditions: [PreSaleConditionInput!]!
  ): Int
}

Parameters

startedAt

Required

Float

The start time of the presale round in UNIX timestamp format.

endedAt

Required

Float

The end time of the presale round in UNIX timestamp format.

tokenAmount

Required

Float

The total amount of tokens available for purchase in this presale round.

tokenPrice

Required

Float

The price per token during this presale round.

conditions

Required

[PreSaleConditionInput!]!

An array of custom conditions for the presale. Each condition includes:

  • name (String): The name of the condition
  • value (String): The value or description of the condition

Return Value

Success Response

Returns an Int representing the unique ID of the newly created presale round.

42

Example: Presale round ID


Example Usage

Request

mutation CreatePresaleRound {
  createNewPresale(
    startedAt: 1704067200.0
    endedAt: 1706745600.0
    tokenAmount: 1000000.0
    tokenPrice: 0.5
    conditions: [
      { name: "Minimum Purchase", value: "100 tokens" }
      { name: "Maximum Purchase", value: "10000 tokens" }
      { name: "Whitelist", value: "Required for first 24 hours" }
      { name: "KYC", value: "Level 2 verification required" }
    ]
  )
}

Response

{
  "data": {
    "createNewPresale": 15
  }
}

Presale Round Created

The presale round has been successfully created with ID 15. This ID can be used to reference and manage this specific presale round.


Use Cases

🚀

Token Launch Events

Create presale rounds for new token launches with specific pricing tiers and time windows.

🎯

Tiered Presales

Set up multiple presale rounds with different prices and token allocations for early supporters.

📋

Custom Conditions

Define custom rules like minimum/maximum purchases, whitelist requirements, or KYC levels.

Time-Limited Sales

Schedule presale rounds with precise start and end times to create urgency and exclusivity.


Best Practices

⏱️ Timing Validation

Ensure endedAt is greater than startedAt to prevent invalid presale periods.

💰 Token Allocation

Set appropriate tokenAmount values based on your total token supply and presale strategy.

📜 Clear Conditions

Define clear and enforceable conditions that participants can easily understand and verify.

🔐 Security First

Consider implementing KYC/AML requirements as conditions for regulatory compliance.