Skip to content

FOR DEVELOPERS · CONTRACTS

Tokens & trades

Listing SENTO tokens, reading their curve and fee state, and following trades before and after graduation.

Launchpad events

Eventtopic0Emitted when
TokenCreated0xc8c4dedf89bcd492a49e06a9fbb1102fafadfc872d0360428000e9f7e399be84A token is launched
TokenPurchased0xa32a723e0e0ccd1f6b2cda064be2605e2dd5b9ca55dfa9b3568023d9c6363190A buy on the curve
TokenSold0xa652120ec8e6368ca90a17fb3f3ecb0564f2b3aae4d3bf9948ce56ee830e4417A sell on the curve
Graduated0xdf9e4d7e38c0b4f9b2b0c31c082370dd912b89a99ebaf6129c106a6b81253f67The curve completes and the Uniswap v4 pool opens
List launches
import { parseAbiItem } from "viem";
import { client, SENTO, START_BLOCK } from "./client";

const tokenCreated = parseAbiItem(
  "event TokenCreated(address indexed token, address indexed creator, bytes32 salt, string tokenURI, uint8 engine, uint16 feeConfigId, address[] quotes, uint16[] weightBps)",
);

const logs = await client.getLogs({
  address: SENTO.launchpad,
  event: tokenCreated,
  fromBlock: START_BLOCK,
  toBlock: START_BLOCK + 10_000n, // walk forward in bounded chunks
});

for (const { args } of logs) {
  // feeConfigId: 1 Classic, 6 Tax, 5 Staking. quotes[0] is the quote asset (address(0) = ETH).
  console.log(args.token, args.creator, args.feeConfigId, args.quotes);
}

Token and curve state

tokenInfo returns what was fixed at launch. curveState and progress describe the curve now: state is 1 while trading, 2 once the target is filled and 3 once the token has migrated to Uniswap v4; progress is parts per million of the raise target.

Read a token
import { parseAbi } from "viem";
import { client, SENTO } from "./client";

const launchpadAbi = parseAbi([
  "function tokenInfo(address token) view returns ((uint8 engine, uint16 feeConfigId, uint16 buyFeeBps, uint16 sellFeeBps, uint16 graduationFeeBps, uint16 curveSupplyBps, uint256 targetRaiseUsd, uint256 y0, uint64 createdAt, address creator, (address quote, uint16 weightBps, uint256 px1e18, uint256 rTarget, uint256 x0, int24 tickLower, int24 tickUpper, bytes32 poolId)[] pools))",
  "function curveState(address token) view returns ((uint8 state, uint256 realQuote, uint256 realToken, uint64 filledAt))",
  "function progress(address token) view returns (uint32)",
  "function quoteBuy(address token, uint256 amountIn) view returns (uint256 amountOut, uint256 fee)",
  "function quoteSell(address token, uint256 amountIn) view returns (uint256 netQuoteOut, uint256 fee)",
]);

const read = (functionName, args) => client.readContract({ address: SENTO.launchpad, abi: launchpadAbi, functionName, args });

const [info, curve, ppm] = await Promise.all([
  read("tokenInfo", [token]),
  read("curveState", [token]),
  read("progress", [token]),
]);

const quote = info.pools[0].quote;       // address(0) = ETH
const raiseTarget = info.pools[0].rTarget; // in quote units, fixed at launch
const graduated = curve.state === 3;
const progress = ppm / 1e6;              // 0 → 1

quoteBuy(token, amountIn) and quoteSell(token, amountIn) return what a curve trade would give right now, fee included. They only apply before graduation.

Fee split of a token

Read the fee route
const feeAbi = parseAbi([
  "function feeSplitOf(address token) view returns ((uint16 buyFeeBps, uint16 sellFeeBps, uint16 platformBuyBps, uint16 platformSellBps, (uint8 kind, address target, uint16 bps, bool creatorEditable)[] creatorShares, uint8 editsUsed))",
]);

const split = await client.readContract({ address: SENTO.feeDistributor, abi: feeAbi, functionName: "feeSplitOf", args: [token] });
// split.buyFeeBps / sellFeeBps: total fee per trade
// split.platformBuyBps / platformSellBps: the platform's part of it
// split.creatorShares: where the rest goes, bps of the rest (sum 10,000)
//   kind 0 ADDRESS (target is paid), 1 DIVIDEND (holders), 3 TREASURY (staking), 4 BUYBACK

Trades after graduation

Once Graduated is emitted the Launchpad no longer trades the token. Its pool is a Uniswap v4 pool; Graduated.poolId (also tokenInfo(token).pools[0].poolId) is the pool's ID. Index the PoolManager's Swap event filtered on that ID.

Eventtopic0
Swap(bytes32 indexed id, address indexed sender, int128 amount0, int128 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick, uint24 fee)0x40e9cecb9f5f1f1c5b9c97dec2917b7ee92e57ba5563708daca94dd84ad7112f
  • The pool's currencies are sorted by address, so ETH (address(0)) is always currency0 in an ETH pool.
  • In v4, amounts are from the swapper's side: a negative amount is paid into the pool. If the token is currency1, amount1 > 0 is a buy.
  • The SENTO hook takes its fee in the quote asset through hook deltas, so the Swap amounts are the pool side of the trade and do not include it. The fee is forwarded to the FeeDistributor in the same transaction and shows up as its events (for example StakingRewardsFunded, TreasuryFunded, BuybackFunded, FeesAccrued).