The purpose of the primitives crate is to put all common types used in HydraDX or Basilisk at one place.
Among others, the following are worth mentioning:
Asset id type used in the system.
Current type: u32
Current type: u128
Current type: FixedU128
Asset pair representation for AMM trades. This is a structure holding the ids of the assets involved in a trade.
A couple of useful methods implemented for AssetPair:
The ordered_pair function returns a tuple where first asset id < second asset id.
The name function constructs a name for the asset pair. This might change slightly in the future because it currently has a hardcoded 'HDT' prefix.
Defaults to SELL
Structure which represents an intention for trade.
ExchangeIntention might be moved to the exchange pallet as it is only used in the exchange algorithm.
An AMM trait is an interface which needs to be implemented by a pool in order to be able to plug it into the exchange pallet.