Kodiak Finance
  • OVERVIEW
    • 🐻‍❄️Introducing Kodiak
    • 🐻Kodiak x Berachain
    • ✉️Contact Us
    • 🍯Kodiak Contracts
  • 🅱️Kodiak-Boyco
  • PROTOCOL
    • 🔃DEX
      • Swaps
      • Liquidity Provision
      • Trading Fees
    • 🏝️Islands
      • Island Liquidity Provision
      • Sweetened Islands
      • Island Mechanics
        • Auto-BGT
        • Real-time Security
        • Rebalancing
        • Strategies
    • 🐼Panda Factory
  • 🪙Tokenomics
    • Kodiak Pre-TGE Rewards
  • 🧠User Guide
    • Launch a Token Launch on Panda Factory
    • Trading on Panda Factory
    • Swap
    • Create a V2 Position
    • Create a V3 Position
    • Add/Stake Islands Liquidity
    • Migrating to a Reward Vault
    • Deploying new Permissonless Islands
    • Deploying and Configuring a Kodiak Farm
    • Add your token
  • Add Your Project to the Ecosystem
  • 👨‍💻Developers
    • 🐼Panda
      • Technical Integration Guide
      • Subgraph
        • Entity Reference
        • Query Guide
        • Advanced Usage Guide
      • Smart Contract Reference
        • Panda Factory
        • Panda Pool
        • Panda Token
      • Api
    • Farms
      • Technical Integration Guide
      • Smart Contract Reference
    • 🌴Kodiak Islands
      • Technical Integration Guide
        • Understanding Token Deposit Ratio
      • Subgraph
        • Entity Reference
        • Query Guide
        • Advanced Usage Guide
      • Smart Contract Reference
        • Kodiak Island Factory
        • Kodiak Island
        • Kodiak Island Router
      • Api
    • 💰Pricing with Subgraph
    • 💱Quotes
    • Backend
  • 🛡️SECURITY
    • 🔍Audits
    • Page
  • ℹ️Informational
    • 📜Terms of Use
    • 🔏Privacy Policy
    • TradingView Advanced License
Powered by GitBook
On this page
  • Deployment Functions
  • Incentive Functions
  • View Functions
  • Constants
  • Events
  1. Developers
  2. Panda
  3. Smart Contract Reference

Panda Factory

The core factory contract for deploying and managing Panda tokens and pools.

Deployment Functions

deployPandaToken

function deployPandaToken(
    address implementation,
    PandaPoolParams calldata pp,
    string calldata name,
    string calldata symbol,
    uint16 deployerSupplyBps
) external nonReentrant returns (address pandaToken)

Deploys a new PandaToken with optional deployer buy.

Parameters:

  • implementation: Address of the implementation contract

  • pp: PandaPoolParams struct containing:

    • baseToken: Address of the base token

    • sqrtPa: Lower bound sqrt price

    • sqrtPb: Upper bound sqrt price

    • vestingPeriod: Vesting duration for deployer incentives

  • name: Token name

  • symbol: Token symbol

  • deployerSupplyBps: Basis points of supply for deployer (max 5000)

Returns:

  • pandaToken: Address of the deployed token

Emits: PandaDeployed

Errors:

  • PandaFactory: INVALID_DEPLOYER_BUY - When deployerSupplyBps > 5000

  • PandaFactory: INVALID_IMPLEMENTATION - When implementation not whitelisted

  • PandaFactory: INVALID_BASE - When base token not configured

  • PandaFactory: PRICES_TOO_CLOSE - When price range too narrow

  • PandaFactory: PRICES_TOO_FAR - When price range too wide

  • PandaFactory: RAISE_TOO_LOW - When minimum raise not met

deployPandaTokenWithBera

function deployPandaTokenWithBera(
    address implementation,
    PandaPoolParams calldata pp,
    string calldata name,
    string calldata symbol,
    uint16 deployerSupplyBps
) external payable nonReentrant returns (address pandaToken)

Deploys a new PandaToken using native BERA with optional deployer buy.

Parameters:

  • implementation: Address of the implementation contract

  • pp: PandaPoolParams struct containing:

    • baseToken: Must be WBERA address

    • sqrtPa: Lower bound sqrt price

    • sqrtPb: Upper bound sqrt price

    • vestingPeriod: Vesting duration for deployer incentives

  • name: Token name

  • symbol: Token symbol

  • deployerSupplyBps: Basis points of supply for deployer (max 5000)

Returns:

  • pandaToken: Address of the deployed token

Errors:

  • PandaFactory: INVALID_BERA - When baseToken is not WBERA

  • All errors from deployPandaToken

deployPandaPool

function deployPandaPool(
    address implementation,
    IPandaFactory.PandaPoolParams calldata pp,
    uint256 totalTokens,
    address pandaToken,
    bytes calldata data
) external nonReentrant returns (address)

Deploy a standalone PandaPool implementation.

Parameters:

  • implementation: Address of the pool implementation

  • pp: PandaPoolParams struct (see above)

  • totalTokens: Total tokens to be managed by pool

  • pandaToken: Address of existing Panda token

  • data: Additional initialization data

Returns:

  • Address of the deployed pool

Errors:

  • PandaFactory: INVALID_IMPLEMENTATION - When implementation not whitelisted

  • PandaFactory: IS_PANDATOKEN - When implementation is a token type

  • PandaFactory: INVALID_PANDATOKEN - When token address is zero

Incentive Functions

claimIncentive

claimIncentive(
    address _pandaPool
) external

Claims deployment incentives after pool graduation.

Parameters:

  • _pandaPool: Address of the graduated pool

Errors:

  • PandaFactory: Invalid pool - When pool not deployed by factory

  • PandaFactory: Incentive already claimed - When incentive already claimed

  • PandaFactory: Pool not graduated - When pool hasn't graduated

View Functions

predictPoolAddress

predictPoolAddress(
    address implementation,
    address deployer
) external view returns (address)

Predicts pool address before deployment.

Parameters:

  • implementation: Implementation contract address

  • deployer: Address of the deployer

Returns:

  • Predicted address of the pool

getSqrtP

getSqrtP(
    uint256 scaledPrice
) external pure returns (uint256)

Converts price to square root format.

Parameters:

  • scaledPrice: Price to convert (scaled by 1e18)

Returns:

  • Square root price in correct scale

getPoolFees

getPoolFees()
external view returns (PandaFees memory)

Get current fee configuration.

Returns:

  • PandaFees struct containing:

    • buyFee: Fee for buying tokens

    • sellFee: Fee for selling tokens

    • graduationFee: Fee taken at graduation

    • deployerFeeShare: Share of graduation fee for deployer

isLegitPool

isLegitPool(
    address _pandaPool
) public view returns (bool)

Verify if pool was deployed by factory.

Parameters:

  • _pandaPool: Address to check

Returns:

  • true if pool was deployed by factory

allPoolsLength

allPoolsLength() external view returns (uint)

Get total number of deployed pools.

Returns:

  • Count of all deployed pools

Constants

public constant MIN_TOKENSINPOOL_SHARE = 5000;    // 50%
uint256 public constant MAX_TOKENSINPOOL_SHARE = 9000;    // 90%
uint256 public constant MIN_SQRTP_MULTIPLE = 11_000;      // 1.1x
uint256 public constant MAX_SQRTP_MULTIPLE = 10*10_000;   // 10x
uint256 public constant TOKEN_SUPPLY = 1_000_000_000 * 1e18;
uint16 public constant DEPLOYER_MAX_BPS = 5000;           // 50%

Events

PandaDeployed(
    address indexed pandaPool,
    address indexed implementation
)

Emitted when new pool is deployed.

IncentiveClaimed(
    address indexed pandaPool,
    uint256 amount
)

Emitted when deployment incentive is claimed.

PreviousSmart Contract ReferenceNextPanda Pool

Last updated 3 months ago

👨‍💻
🐼