SDKs@solio/coreContractsBondingCurvegetBurnAmount

getBurnAmount()

function getBurnAmount(client, props): Promise<bigint>

Reads the native token amount that needs to be burned when a certain amount of mixed token is burned.

Parameters

ParameterTypeDescription
clientReadClientReadClient The read client to use.
propsBondingCurveGetBurnAmountPropsBondingCurveGetBurnAmountProps The properties to use.
  • BondingCurveGetBurnAmountProps
type BondingCurveGetBurnAmountProps: BondingCurveProps & {
  address: Address;
  mixedTokenAmount: bigint;
  currentSupply: bigint;
};

Returns

Promise<bigint>

The native token amount.

Examples

bonding-curve.ts
// for exponential
import { bondingCurve } from '@solio/core';
import { createClient, http } from 'viem';
import { sepolia } from 'viem/chains';
const readClient = createClient({
 chain: sepolia,
 transport: http(),
});
const amount = await bondingCurve.read.getBurnAmount(readClient, {
   address: '0x...', // bonding curve contract address
  type: 'exponential',
  param: {
    a: 10000000000000000n,
    b: 100000000000000000000000n,
  },
  mixedTokenAmount: 10000000000000000n,
})
bonding-curve.ts
// for linear
import { bondingCurve } from '@solio/core';
import { createClient, http } from 'viem';
import { sepolia } from 'viem/chains';
const readClient = createClient({
 chain: sepolia,
 transport: http(),
});
const amount = await bondingCurve.read.getBurnAmount(readClient, {
  address: '0x...', // bonding curve contract address
  type: 'linear',
  param: {
    initPrice: 0.001,
    finalPrice: 1000,
    supply: 1e32,
  },
  mixedTokenAmount: 10000000000000000n,
})