Skip to content

create

Deploys a Bonding Curved ERC-20 Contract

Usage

Below is a basic example of how to call the create function.

curvedata-example.ts
import { mintclub } from 'mint.club-v2-sdk';
import { curveData } from './data';
 
await mintclub
  .network('ethereum')
  .token('MINT')
  .create({
    name: 'Mint Club',
    reserveToken: {
      address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address 
      decimals: 18, 
    }, 
	curveData, 
  })

Return Value

TransactionReceipt | undefined

The receipt for the signed transaction.

Parameters

name

The token name.

  • Type: string
await mintclub
  .network('ethereum')
  .token('MINT')
  .create({
    name: 'Mint Club', 
    reserveToken: {
      address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address
      decimals: 18,
    },
    curveData
  })

reserveToken

  • Type: { address: '0x${string}'; decimals: number }

The reserve token to use for the bonding curve. This is the token that will be used to mint new tokens.

await mintclub
  .network('ethereum')
  .token('MINT')
  .create({
    name: 'Mint Club',

    reserveToken: { 

      address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address
      decimals: 18, 
    }, 
    curveData
  })

curveData (conditionally required)

If stepData is not provided, curveData is required.

It will automatically generate a bonding curve data with the given curve type for you.

curveData is an object with the following properties:

curveType
  • Type: string

Can be one of : "LINEAR" "EXPONENTIAL" "LOGARITHMIC" "FLAT"

stepCount
  • Type: number

This is the number of steps the curve will have. The more steps, the more granular the curve will be. Since this data is stored on-chain, Greater stepCount will result in higher gas costs.

maxSupply
  • Type: number

The maximum supply of the token.

initialMintingPrice
  • Type: number

The initial price of the token on the bonding curve.

finalMintingPrice
  • Type: number

The final price of the token on the bonding curve.

creatorAllocation (optional)
  • Type: number
  • Default: 0

The amount of tokens that will be allocated to the creator of the bonding curve upon deployment.

example.ts
import { curveData } from './curve-data';
 
await mintclub
  .network('ethereum')
  .token('MINT')
  .create({
    name: 'Mint Club',
    reserveToken: {
      address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address 
      decimals: 18, 
    }, 

	curveData, 

  })

stepData (conditionally required)

  • Type: { rangeTo: number; price: number }[]

If curveData is not provided, stepData is required.

Steps that will be used to construct the bonding curve. The rangeTo property is the number of tokens that will be minted until the given price. The price property is the price of the token in the reserve token.

If price is 0, the first rangeTo tokens will be allocated to the creator of the bonding curve.

example.ts
import { stepData } from './step-data';
 
await mintclub
  .network('ethereum')
  .token('MINT')
  .create({
    name: 'Mint Club',
    reserveToken: {
      address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address 
      decimals: 18, 
    }, 

	stepData, 

  })

buyRoyalty (optional)

  • Type: number
  • Default: 0.03

buyRoyalty is the percentage of the buy trade fee that will go to the creator.

await mintclub
  .network('ethereum')
  .token('MINT')
  .create({
    name: 'Mint Club',
    reserveToken: {
      address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address 
      decimals: 18,
    }, 
    curveData,
    buyRoyalty: 0.03, 
  })

sellRoyalty (optional)

  • Type: number
  • Default: 0.03

sellRoyalty is the percentage of the sell trade fee that will go to the creator.

await mintclub
  .network('ethereum')
  .token('MINT')
  .create({
    name: 'Mint Club',
    reserveToken: {
      address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address 
      decimals: 18,
    }, 
    curveData,
    sellRoyalty: 0.03, 
  })

onSignatureRequest (optional)

  • Type: onSignatureRequest?: () => void;
  • Default: undefined

Callback function for when the user is requested to sign the transaction.

await mintclub
  .network('ethereum')
  .token('MINT')
  .create({
    name: 'Mint Club',
    reserveToken: {
      address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address 
      decimals: 18,
    }, 
    curveData,
	onSignatureRequest: () => {} 
  })

onSigned (optional)

  • Type: onSigned?: (txHash: '0x${string}') => void;
  • Default: undefined

Callback function for when the user is signs the transaction.

await mintclub
  .network('ethereum')
  .token('MINT')
  .create({
    name: 'Mint Club',
    reserveToken: {
      address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address 
      decimals: 18,
    }, 
    curveData,
	onSigned: (txHash) => {} 
  })

onSuccess (optional)

  • Type: onSuccess?: (receipt: TransactionReceipt) => void;
  • Default: undefined

Callback function for when the transaction is successful.

await mintclub
  .network('ethereum')
  .token('MINT')
  .create({
    name: 'Mint Club',
    reserveToken: {
      address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address 
      decimals: 18,
    }, 
    curveData,
	onSuccess: (receipt) => {} 
  })

onError (optional)

  • Type: onError?: (error: unknown) => void;
  • Default: undefined

Callback function for when the transaction fails. This also includes when the user rejects the transaction.

await mintclub
  .network('ethereum')
  .token('MINT')
  .create({
    name: 'Mint Club',
    reserveToken: {
      address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // mainnet WETH token address 
      decimals: 18,
    }, 
    curveData,
	onError: (error) => {} 
  })