Skip to main content

Common Types

Overview

This is a collection of types which are commonly used in Astroport contracts.

Data Types

AssetInfo

AssetInfo is a convenience wrapper to represent whether a token is the native one (from a specific chain, like LUNA for Terra) or not. It also returns the contract address of that token.

asset.rs
Copy

_4
pub enum AssetInfo {
_4
Token { contract_addr: Addr },
_4
NativeToken { denom: String },
_4
}

VariantsDescription
TokenNon-native Token
NativeTokenNative token

Asset

This enum contains asset info and a token amount.

json
asset.rs
Copy

_8
{
_8
"info": {
_8
"token": {
_8
"contract_addr": "..."
_8
}
_8
},
_8
"amount": "100000"
_8
}

ParamsTypeDescription
infoAssetInfoInformation about an asset stored in a [AssetInfo] struct
amountUint128A token amount

DecimalAsset

This struct describes an asset as decimal.

json
asset.rs
Copy

_8
{
_8
"info": {
_8
"token": {
_8
"contract_addr": "..."
_8
}
_8
},
_8
"amount": "0.12345"
_8
}

ParamsTypeDescription
infoAssetInfoInformation about an asset stored in a [AssetInfo] struct
amountDecimal256A token decimal amount

PairInfo

It is used to represent response data coming from a Pair-Info-Querier.

json
asset.rs
Copy

_19
{
_19
"asset_infos": [
_19
{
_19
"token": {
_19
"contract_addr": "..."
_19
}
_19
},
_19
{
_19
"native_token": {
_19
"denom": "..."
_19
}
_19
}
_19
],
_19
"contract_addr": "...",
_19
"liquidity_token": "...",
_19
"pair_type": {
_19
"xyk": {}
_19
}
_19
}

ParamsTypeDescription
asset_infosVec<AssetInfo>Asset information for the assets in the pool
contract_addrAddrPair contract address
liquidity_tokenAddrPair LP token address
pair_typePairTypeThe pool type (xyk, stableswap, etc) available in [PairType]

OwnershipProposal

This structure describes the parameters used for creating a request for a change of contract ownership.

json
common.rs
Copy

_4
{
_4
"owner": "...",
_4
"ttl": 123456
_4
}

ParamsTypeDescription
ownerAddrThe newly proposed contract owner
ttlu64Time until the proposal to change ownership expires