---
# System prepended metadata

title: CurrencyId

---

# CurrencyId

enum `CurrencyId` defines all asset types of fungible token on Acala/Karura,
  
```
pub enum DexShare {
	Token(TokenSymbol),
	Erc20(EvmAddress),
	LiquidCrowdloan(Lease),
	ForeignAsset(ForeignAssetId),
	StableAssetPoolToken(StableAssetPoolId),
}
```

Different types of asset have different definition rules for their metadata(symbol, name, decimals, etc.)


## Token(TokenSymbol)
`CurrencyId::Token` assets are generally native assets, but there are some exceptions, such as DOT,KSM are native assets of relaychain, BNC is the native asset of parachain Bifrost. 
This is because Acala/Karura has not expanded the definition of enum `CurrencyId` yet before. And now, such external assets use the `CurrencyId::ForeignAsset`), and specific assets are distinguished by enum `TokenSymbol`.

This is the definition of enum `TokenSymbol` :

```
pub enum TokenSymbol {
	// 0 - 19: Acala & Polkadot native tokens
	ACA("Acala", 12) = 0,
	AUSD("Acala Dollar", 12) = 1,
	DOT("Polkadot", 10) = 2,
	LDOT("Liquid DOT", 10) = 3,
	TAP("Tapio", 12) = 4,
	// 20 - 39: External tokens (e.g. bridged)
	RENBTC("Ren Protocol BTC", 8) = 20,
	CASH("Compound CASH", 8) = 21,
	// 40 - 127: Polkadot parachain tokens

	// 128 - 147: Karura & Kusama native tokens
	KAR("Karura", 12) = 128,
	KUSD("Karura Dollar", 12) = 129,
	KSM("Kusama", 12) = 130,
	LKSM("Liquid KSM", 12) = 131,
	TAI("Taiga", 12) = 132,
	// 148 - 167: External tokens (e.g. bridged)
	// 149: Reserved for renBTC
	// 150: Reserved for CASH
	// 168 - 255: Kusama parachain tokens
	BNC("Bifrost Native Token", 12) = 168,
	VSKSM("Bifrost Voucher Slot KSM", 12) = 169,
	PHA("Phala Native Token", 12) = 170,
	KINT("Kintsugi Native Token", 12) = 171,
	KBTC("Kintsugi Wrapped BTC", 8) = 172,
}
```

The item name of enum `TokenSymbol` is the symbol of the asset, the first string in tuple is the name, and the second integer in tuple is the decimals symbol.

Examples:

```
CurrencyId::Token(TokenSymbol::ACA) // ACA on Acala
CurrencyId::Token(TokenSymbol::AUSD) // aUSD on Acala
CurrencyId::Token(TokenSymbol::DOT) // DOT on Acala
CurrencyId::Token(TokenSymbol::KUSD) // aUSD on Karura
```

## Erc20(EvmAddress)
Defines the ERC20 token type assets in Acala/Karura EVM+. ERC20 token contracts are deployed in Acala/Karura EVM+, the Acala/Karura runtime can also call the ERC20 contract interface in EVM+, use `CurrencyId::Erc20(EvmAddress)` to map the specific ERC20 token.

`EvmAddress` is the contract address of the ERC20 token. The symbol, name, and decimals of the ERC20 token are all defined by the contract. For some ERC20 tokens commonly used by Acala/Karura runtime, usually `assets-registry` module will register the metadata of these ERC20 tokens (metadata will be read from the contract of ERC20 token, saved in `assetRegistry.assetMetadatas`, `assets-registry` can also overwrite these metadata), for direct use by runtime, it is also convenient for front-end query.

Examples:

```
CurrencyId::Erc20(0x07df96d1341a7d16ba1ad431e2c847d978bc2bce) // USDCet(Portal) on Acala
CurrencyId::Erc20(0x54a37a01cd75b616d63e0ab665bffdb0143c52ae) // DAI(Portal) on Acala
CurrencyId::Erc20(0x1f3a10587a20114ea25ba1b388ee2dd4a337ce27) // USDCet(Portal) on Karura
CurrencyId::Erc20(0x4bb6afb5fa2b07a5d1c499e1c3ddb5a15e709a71) // DAI(Portal) on Karura
CurrencyId::Erc20(0xe20683ad1ed8bbeed7e1ae74be10f19d8045b530) // waUSD(Portal from Acala) on Karura
```


## StableAssetPoolToken(StableAssetPoolId)
Defines the LP token asset type for the liquidity pool of stable-assets. `StableAssetPoolId` is the id of the stable-assets pool, details of the pool can be queried through `stableAssets.pool(StableAssetPoolId)`. 

The metadata of this type of assets is registered in `assets-registry`, which can be queried through `assetsRegistry.assetsMetadata`.

Examples:

```
CurrencyId::StableAssetPoolToken(0) // the LP token of the stable-assets pool DOT-LDOT on Acala
CurrencyId::StableAssetPoolToken(0) // the LP token of the stable-assets pool KSM-LKSM on Karura
CurrencyId::StableAssetPoolToken(1) // the LP token of the stable-assets pool aUSD-USDCet-USDT on Karura
```

## LiquidCrowdloan(Lease)
Currently this type of asset only appears in Acala. When Acala won the first slot auction of Polkadot, users who contributed DOT for Acala in the form of liquid crowdloan will get `LcDOT` at a 1:1 ratio.
`Lease` is the ended slot lease of the parachain slot, the ended lease that Acala first won is 13, so `LcDOT` is `CurrencyId::LiquidCrowdloan(13)`.

The metadata of this type of assets is registered in `assets-registry`, which can be queried through `assetsRegistry.assetsMetadata`.

Examples:

```
CurrencyId::LiquidCrowdloan(13) // LcDOT on Acala
```

## ForeignAsset(ForeignAssetId)
Defines the external assets which source is other parachains. If the native assets of other parachains are to be successfully transferred to Acala/Karura through XCM, they must be registered in `assets-registry`. In addition to metadata such as name, symbol, decimals, need to provide MultiLocation (which defines the asset's origin chain and token identification on the origin chain). When registering `ForeignAsset`, `ForeignAssetId` cannot be specified arbitrarily, `assets-registry` will assign an unique id.

The metadata of this type of assets is registered in `assets-registry`, which can be queried through `assetsRegistry.assetsMetadata`.

Examples:

```
CurrencyId::ForeignAsset(3) // IBTC(interBTC from Interlay) on Acala
CurrencyId::ForeignAsset(0) // GLMR(Moonbeam native token) on Acala
CurrencyId::ForeignAsset(2) // ASTR(Astar native token) on Acala
CurrencyId::ForeignAsset(7) // USDT(from Statemine) on Karura
CurrencyId::ForeignAsset(18) // SDN(Shiden native token) on Karura
CurrencyId::ForeignAsset(3) // MOVR(Moonriver native token) on Karura

```

## DexShare(DexShare, DexShare)
Defines the LP token asset type of Acala/Karura DEX. All trading pairs of Acala/Karura DEX are composed of two assets, the two `DexShare` types in the tuple indicate the two assets that composed the trading pair. `DexShare` in the tuple is another enum type, not the `DexShare` item in enum `CurrencyId`!

```
pub enum DexShare {
	Token(TokenSymbol),
	Erc20(EvmAddress),
	LiquidCrowdloan(Lease),
	ForeignAsset(ForeignAssetId),
	StableAssetPoolToken(StableAssetPoolId),
}
```

The item naming in enum `DexShare` is almost the same as the item in enum `CurrencyId`(except no `CurrencyId::DexShare` item), the item in enum `DexShare` indicates the same asset as the item in enum `CurrencyId`. Why not just define it as `CurrencyId::DexShare(CurrencyId, CurrencyId)` ? Rust does not allow such nested type definitions, so the enum `DexShare` type is additionally defined as a wrapper.

`DexShare(DexShare, DexShare)` type assets will not be registered metadata in `assets-registry`, the system use the decimals of the first `DexShare` of the tuple as its decimals. For example, there is a trading pair ACA-DOT in DEX, the CurrencyId of its LP token is `CurrencyId::DexShare(DexShare::Tokens(ACA), DexShare::Tokens(DOT))`, the decimals of LP token is 12, which is equal to the decimals of ACA `CurrencyId::Tokens(ACA)`. 

```
CurrencyId::DexShare(
	DexShare::Token(TokenSymbol::AUSD), 
	DexShare::Token(TokenSymbol::DOT), 
) // the LP token of the DEX trading pair aUSD-DOT on Acala

CurrencyId::DexShare(
	DexShare::Token(TokenSymbol::AUSD), 
	DexShare::LiquidCrowdloan(13), 
) // the LP token of the DEX trading pair aUSD-LcDOT on Acala

CurrencyId::DexShare(
	DexShare::Token(TokenSymbol::AUSD), 
	DexShare:: ForeignAsset(3), 
) // the LP token of the DEX trading pair aUSD-IBTC on Acala

```