Skip to content

Market Pairs

In order to prevent bad actors from spamming our orderbook, we have come up with the idea of Market Pairs. By default, our orderbook rejects app calls to create new orders unless the underlying assets are already registered as Market Pairs on our Orderbook. To Open a Market users need to pay a fee to register the Market with our Orderbook Smart Contract. This purpose of the fee is two fold:

  • It cover’s the minimum balance requirments for storing a market pair in Smart contact memory
  • Disincentivizes Bad Actors from opening fictitious Market’s as doing so will result in a material finanical loss to them

Formatting

Market Pairs are composed from the Asset IDs of two ASA’s on the Algorand Blockchain.
We consider Algo to have an Asset ID of 0.
Our sincerest apologies to anyone interested in trading Joe-Coin

Market Pair Example

const usdcMainNetID = 31566704;
const algoMainNetID = 0; // In our mental model algo has 0 id
const marketPair: [number, number] = makeMarketPair(
usdcMainNetID,
algoMainNetID
);
console.log(marketPair); // Outputs: [0, 31566704]
// Market Pairs are always sorted in ascending order

Storage

Market pairs are stored on-chain in our Orderbook Smart Contract using Box Storage. We create a custom tuple from the sorted Asset ID’s and use that as the Market Key in our Box Storage Map. Fee information and the market pair opener are stored as the corresponding value.