Factory
Overview
The factory creates new Astroport pools (and their LP tokens) and keeps the registry of pools, one per set of assets. It also holds the configuration of every pool type it can create: the code ID, the fees and whether anyone can create that type.
The factory owner is the protocol owner on each chain: the satellite ("Astroport Assembly") on Terra and the Assembly on Neutron, both run by the Astroport Contributors DAO (see Access Controls and Permissions). Only the owner can change the configuration or deregister pools.
Pool types and fees configured on mainnet (2026-11-04):
| Pair type | Terra (factory 1.8.0) | Neutron (factory 1.9.0) |
|---|---|---|
{"xyk": {}} | 30 bps, 1/3 to Maker (maker_fee_bps 3333) | 30 bps, 1/3 to Maker |
{"stable": {}} | 5 bps, 1/2 to Maker (5000) | 5 bps, 1/2 to Maker |
{"custom": "concentrated"} (PCL) | Fee set per pool by its parameters, 1/2 to Maker | Same |
| Concentrated with Duality orderbook | n/a | Fee set per pool, 1/2 to Maker |
| Transmuter | Permissioned, no fees | Permissioned |
| xASTRO pair (xASTRO is retired) | n/a | Permissioned, can't be incentivized |
| XYK with sale tax | n/a | Disabled |
Links
- Terra Address: terra14x9fr055x5hvr48hzy2t4q7kvjvfttsvxusa4xsdcy702mnzsvuqprer8r (
astroport-factory1.8.0) - Neutron Address: neutron1hptk0k5kng7hjy35vmh009qd5m6l33609nypgf2yc6nqnewduqasxplt4e (
astroport-factory1.9.0) - Contract Repo: https://github.com/astroport-fi/astroport-core/tree/main/contracts/factory
- contract.rs: https://github.com/astroport-fi/astroport-core/blob/main/contracts/factory/src/contract.rs
- factory.rs: https://github.com/astroport-fi/astroport-core/blob/main/packages/astroport/src/factory.rs
- Tests: https://github.com/astroport-fi/astroport-core/tree/main/contracts/factory/tests
This page documents the messages of astroport-factory 1.10.0 in astroport-core main. The deployed factories are 1.8.0 (Terra) and 1.9.0 (Neutron). The 1.10.0 migration from 1.8/1.9 adds the whitelist field of PairConfig; the deployed factories don't have it. The generator_address field keeps its old name but holds the Incentives contract address.
InstantiateMsg
Initializes the factory with the pool types it can create, the Maker (fee_address), the Incentives contract, the coin registry and the owner.
| Params | Type | Description |
|---|---|---|
pair_configs | Vec<PairConfig> | The pool types the factory can create |
token_code_id | u64 | CW20 token code ID, used by pool versions that issue a CW20 LP token |
fee_address | Option<String> | The Maker contract, which receives the Maker share of swap fees |
generator_address | Option<String> | The Incentives contract. Pools stake LP tokens there when auto_stake is set, and deregister deactivates the pool there |
owner | String | Address allowed to change the factory configuration |
whitelist_code_id | u64 | CW1 whitelist code ID, used to store third-party staking rewards |
coin_registry_address | String | The native coin registry, which stores the decimals of native denoms |
tracker_config | Option<TrackerConfig> | Code ID of the tokenfactory tracker and the tokenfactory module address, for pools that track LP balances |
PairConfig
The configuration of a pool type.
| Params | Type | Description |
|---|---|---|
code_id | u64 | Code ID used to instantiate pools of this type |
pair_type | PairType | The pool type |
total_fee_bps | u16 | Total swap fee in basis points (at most 10,000). Pool types with their own fee model, such as PCL, set fees in the pool parameters instead |
maker_fee_bps | u16 | Share of the swap fee sent to the Maker, in basis points of the fee (10,000 = 100%) |
is_disabled | bool | If true, no new pools of this type can be created. Existing pools keep working |
is_generator_disabled | bool | If true, pools of this type can't be incentivized in the Incentives contract |
permissioned | bool | If true, only the owner (or, from 1.10.0, an address in whitelist) can create pools of this type |
whitelist | Option<Vec<String>> | 1.10.0 only. Addresses allowed to create pools of a permissioned type |
PairType
The pool type, as stored in pair configs and returned by pools in PairInfo.
| Variants | Description |
|---|---|
xyk | Constant product pool: {"xyk": {}} |
stable | Stableswap pool: {"stable": {}} |
custom | Any other type, named by a string, for example {"custom": "concentrated"} |
TrackerConfig
| Params | Type | Description |
|---|---|---|
code_id | u64 | Code ID of the tokenfactory tracker contract |
token_factory_addr | String | The tokenfactory module address |
ExecuteMsg
update_config
Updates the factory configuration. Only the owner can call it. Every field is optional; omitted fields are unchanged.
| Params | Type | Description |
|---|---|---|
token_code_id | Option<u64> | CW20 token code ID |
fee_address | Option<String> | The Maker contract |
generator_address | Option<String> | The Incentives contract |
whitelist_code_id | Option<u64> | CW1 whitelist code ID |
coin_registry_address | Option<String> | The native coin registry |
update_tracker_config
Sets the tokenfactory tracker code ID. Only the owner can call it. token_factory_addr is required the first time and ignored afterwards.
| Params | Type | Description |
|---|---|---|
tracker_code_id | u64 | Code ID of the tokenfactory tracker contract |
token_factory_addr | Option<String> | The tokenfactory module address |
update_pair_config
Adds a pool type or replaces its configuration: code ID, fees, and whether it is disabled, can be incentivized or is permissioned. Only the owner can call it. Fee changes apply to existing pools of the type, since pools read their fees from the factory.
As an example, a pool type that charges 30 bps and sends 1/3 of it to the Maker has total_fee_bps 30 and maker_fee_bps 3333: 3333 / 10,000 * 30 bps = 0.1% of each swap goes to the Maker.
| Params | Type | Description |
|---|---|---|
config | PairConfig | The new configuration of the pool type |
create_pair
Creates a pool and registers it. Anyone can call it unless the pool type is permissioned. It fails if a pool for these assets already exists or if the type is disabled. The pool is instantiated with the factory owner as its admin. Pools mint a tokenfactory LP denom, so attach the chain's tokenfactory denom creation fee, if any, as funds; the factory passes them to the pool.
Custom pool types may need extra parameters, packed in init_params (see each pool page).
| Params | Type | Description |
|---|---|---|
pair_type | PairType | The pool type |
asset_infos | Vec<AssetInfo> | The assets of the pool |
init_params | Option<Binary> | Base64-encoded pool parameters for types that need them |
deregister
Removes a pool from the registry, so a new pool (of any type) can be created for the same assets. Only the owner can call it. The factory also deactivates the pool in the Incentives contract. The pool contract itself keeps working.
| Params | Type | Description |
|---|---|---|
asset_infos | Vec<AssetInfo> | The assets of the pool to deregister |
propose_new_owner
Creates an offer to change the factory owner. Only the owner can call it. The offer expires after expires_in seconds.
| Params | Type | Description |
|---|---|---|
owner | String | Newly proposed owner |
expires_in | u64 | Seconds until the offer expires |
drop_ownership_proposal
Removes an existing offer to change the owner. Only the owner can call it.
claim_ownership
Accepts an offer. Only the proposed owner can call it.
QueryMsg
config
Returns the factory configuration.
ConfigResponse
Example from the Terra factory (pair configs shortened).
| Params | Type | Description |
|---|---|---|
owner | Addr | The factory owner |
pair_configs | Vec<PairConfig> | The configured pool types |
token_code_id | u64 | CW20 token code ID |
fee_address | Option<Addr> | The Maker contract |
generator_address | Option<Addr> | The Incentives contract |
whitelist_code_id | u64 | CW1 whitelist code ID |
coin_registry_address | Addr | The native coin registry |
pair
Returns the PairInfo of the registered pool for the given assets.
| Params | Type | Description |
|---|---|---|
asset_infos | Vec<AssetInfo> | The assets of the pool |
pairs
Returns registered pools, paginated. Results start after the pool whose assets are start_after. limit defaults to 10 and is capped at 30.
| Params | Type | Description |
|---|---|---|
start_after | Option<Vec<AssetInfo>> | The assets of the pool to start after |
limit | Option<u32> | The maximum number of pools to return |
PairsResponse
| Params | Type | Description |
|---|---|---|
pairs | Vec<PairInfo> | The pools |
fee_info
Returns the fee configuration of a pool type.
| Params | Type | Description |
|---|---|---|
pair_type | PairType | The pool type |
FeeInfoResponse
| Params | Type | Description |
|---|---|---|
fee_address | Option<Addr> | The Maker contract |
total_fee_bps | u16 | Total swap fee in basis points |
maker_fee_bps | u16 | Share of the swap fee sent to the Maker, in basis points of the fee |
blacklisted_pair_types
Returns the pool types that are disabled or can't be incentivized, as a Vec<PairType>.
tracker_config
Returns the TrackerConfig. Fails if none is set.