Panda Factory
The core factory contract for deploying and managing Panda tokens and pools.
Deployment Functions
deployPandaToken
Deploys a new PandaToken with optional deployer buy.
Parameters:
implementation
: Address of the implementation contractpp
: PandaPoolParams struct containing:baseToken
: Address of the base tokensqrtPa
: Lower bound sqrt pricesqrtPb
: Upper bound sqrt pricevestingPeriod
: Vesting duration for deployer incentives
name
: Token namesymbol
: Token symboldeployerSupplyBps
: Basis points of supply for deployer (max 5000)
Returns:
pandaToken
: Address of the deployed token
Emits: PandaDeployed
Errors:
PandaFactory: INVALID_DEPLOYER_BUY
- When deployerSupplyBps > 5000PandaFactory: INVALID_IMPLEMENTATION
- When implementation not whitelistedPandaFactory: INVALID_BASE
- When base token not configuredPandaFactory: PRICES_TOO_CLOSE
- When price range too narrowPandaFactory: PRICES_TOO_FAR
- When price range too widePandaFactory: RAISE_TOO_LOW
- When minimum raise not met
deployPandaTokenWithBera
Deploys a new PandaToken using native BERA with optional deployer buy.
Parameters:
implementation
: Address of the implementation contractpp
: PandaPoolParams struct containing:baseToken
: Must be WBERA addresssqrtPa
: Lower bound sqrt pricesqrtPb
: Upper bound sqrt pricevestingPeriod
: Vesting duration for deployer incentives
name
: Token namesymbol
: Token symboldeployerSupplyBps
: Basis points of supply for deployer (max 5000)
Returns:
pandaToken
: Address of the deployed token
Errors:
PandaFactory: INVALID_BERA
- When baseToken is not WBERAAll errors from deployPandaToken
deployPandaPool
Deploy a standalone PandaPool implementation.
Parameters:
implementation
: Address of the pool implementationpp
: PandaPoolParams struct (see above)totalTokens
: Total tokens to be managed by poolpandaToken
: Address of existing Panda tokendata
: Additional initialization data
Returns:
Address of the deployed pool
Errors:
PandaFactory: INVALID_IMPLEMENTATION
- When implementation not whitelistedPandaFactory: IS_PANDATOKEN
- When implementation is a token typePandaFactory: INVALID_PANDATOKEN
- When token address is zero
Incentive Functions
claimIncentive
Claims deployment incentives after pool graduation.
Parameters:
_pandaPool
: Address of the graduated pool
Errors:
PandaFactory: Invalid pool
- When pool not deployed by factoryPandaFactory: Incentive already claimed
- When incentive already claimedPandaFactory: Pool not graduated
- When pool hasn't graduated
View Functions
predictPoolAddress
Predicts pool address before deployment.
Parameters:
implementation
: Implementation contract addressdeployer
: Address of the deployer
Returns:
Predicted address of the pool
getSqrtP
Converts price to square root format.
Parameters:
scaledPrice
: Price to convert (scaled by 1e18)
Returns:
Square root price in correct scale
getPoolFees
Get current fee configuration.
Returns:
PandaFees struct containing:
buyFee
: Fee for buying tokenssellFee
: Fee for selling tokensgraduationFee
: Fee taken at graduationdeployerFeeShare
: Share of graduation fee for deployer
isLegitPool
Verify if pool was deployed by factory.
Parameters:
_pandaPool
: Address to check
Returns:
true
if pool was deployed by factory
allPoolsLength
Get total number of deployed pools.
Returns:
Count of all deployed pools
Constants
Events
Emitted when new pool is deployed.
Emitted when deployment incentive is claimed.
Last updated