Integration Guide

Overview

This guide covers the basics of integrating trading of Ai-Mi's on the Bonding Curve within Ai-Mi, for a full lifecycle integration developers will also need to follow the guides on Uniswap in order to integrate the trading of Ai-Mi's after the bonding curve target is reached.

Trading Ai-Mi Tokens on Bonding Curve

Once created, each AiMi has its own bonding curve contract, allowing dynamic pricing and on-chain trades.

Buy

function buyTokens(uint256 amount, uint256 maxExpectedEth) external payable;

Sell

function sellTokens(uint256 amount, uint256 minExpectedEth) external;

Tokens are non-transferable until graduation.

Graduation to Uniswap

After bonding supply is depleted, tokens migrate to Uniswap:

  • Automatically if getGraduatedByAiMi() is true

  • Manually via initLpByFactory(...)

Liquidity is deployed into two pools:

  • AiMiToken/ETH

  • AgentToken/AiMiToken

Integration Snippets

Buy Tokens

const curve = new ethers.Contract(bondingCurveAddress, bondingCurveAbi, signer);
await curve.buyTokens(amount, maxExpectedEth, { value });

Sell Tokens

await curve.sellTokens(amount, minExpectedEth);

Events

  • BondingCurveCreated(address token, address bondingCurve, address creator, string name, string symbol)

  • TokenTraded(...)

  • TokenToUniV2Dex(...)

  • LiquidityRemoved(...)

These should be indexed by frontends or analytics tools.

Post-Bonding Curve Integration

After a token allocation is fully exhausted on the BondingCurve.sol developers will need to obtain the relevant pool address created on the Uniswap V2 system.

For developers interested in integrating Ascension (Bonding Curve Completed) trading can follow the documentation here:

Uniswap V2 Integration Guide


For more advanced integration, see the ABI files or contact the Ai-Mi core team.

Last updated