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
pub enum AssetInfo {
Token { contract_addr: Addr },
NativeToken { denom: String },
}
VariantsDescription
TokenNon-native Token
NativeTokenNative token

Asset

This enum contains asset info and a token amount.

json
asset.rs
Copy
{
"info": {
"token": {
"contract_addr": "..."
}
},
"amount": "100000"
}
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
{
"info": {
"token": {
"contract_addr": "..."
}
},
"amount": "0.12345"
}
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
{
"asset_infos": [
{
"token": {
"contract_addr": "..."
}
},
{
"native_token": {
"denom": "..."
}
}
],
"contract_addr": "...",
"liquidity_token": "...",
"pair_type": {
"xyk": {}
}
}
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
{
"owner": "...",
"ttl": 123456
}
ParamsTypeDescription
ownerAddrThe newly proposed contract owner
ttlu64Time until the proposal to change ownership expires