Skip to main content

Common Types

Overview​

Types used across Astroport contracts, from the astroport package.

Data Types​

AssetInfo​

Identifies an asset: a native denom (bank, IBC or tokenfactory, such as uluna or factory/<creator>/<subdenom>) or a CW20 token contract.

asset.rs
Copy

_5
#[cw_serde]
_5
pub enum AssetInfo {
_5
Token { contract_addr: Addr },
_5
NativeToken { denom: String },
_5
}

VariantsDescription
tokenA CW20 token: {"token": {"contract_addr": "terra1..."}}
native_tokenA native denom: {"native_token": {"denom": "uluna"}}

Asset​

An asset and an amount.

json
asset.rs
Copy

_8
{
_8
"info": {
_8
"native_token": {
_8
"denom": "ibc/8D8A7F7253615E5F76CB6252A1E1BD921D5EDB7BBAAF8913FB1C77FF125D9995"
_8
}
_8
},
_8
"amount": "1000000"
_8
}

ParamsTypeDescription
infoAssetInfoThe asset
amountUint128The amount, in the asset's smallest unit

DecimalAsset​

An asset with a decimal amount.

json
asset.rs
Copy

_8
{
_8
"info": {
_8
"native_token": {
_8
"denom": "ibc/8D8A7F7253615E5F76CB6252A1E1BD921D5EDB7BBAAF8913FB1C77FF125D9995"
_8
}
_8
},
_8
"amount": "1.5"
_8
}

ParamsTypeDescription
infoAssetInfoThe asset
amountDecimal256The amount as a decimal

PairInfo​

Describes a pool. Returned by a pool's pair query and the factory's pair and pairs queries.

json
asset.rs
Copy

_19
{
_19
"asset_infos": [
_19
{
_19
"native_token": {
_19
"denom": "uluna"
_19
}
_19
},
_19
{
_19
"native_token": {
_19
"denom": "ibc/E8481AD838C31D4FC12A504B10F9B4E2F830F8818D2735C2FFC707579B5FA60B"
_19
}
_19
}
_19
],
_19
"contract_addr": "terra1...pool",
_19
"liquidity_token": "factory/terra1...pool/astroport/share",
_19
"pair_type": {
_19
"xyk": {}
_19
}
_19
}

ParamsTypeDescription
asset_infosVec<AssetInfo>The pool's assets
contract_addrAddrThe pool contract address
liquidity_tokenStringThe LP token: a tokenfactory denom (factory/<pool>/astroport/share) for current pools, or a CW20 address for older ones
pair_typePairTypeThe pool type

OwnershipProposal​

A pending offer to change a contract's owner, created by propose_new_owner.

json
common.rs
Copy

_4
{
_4
"owner": "terra1...",
_4
"ttl": 1731300000
_4
}

ParamsTypeDescription
ownerAddrThe proposed owner
ttlu64Time (in seconds since epoch) when the offer expires