Skip to content
This repository was archived by the owner on Jan 16, 2022. It is now read-only.

Market liquidity decimals may not have 18 decimals, and ordering of addresses relative to price mocks must be better handled in the tests #138

@mesozoic-technology

Description

@mesozoic-technology

Currently there's a preconception that our markets will be ETH/OVL adjacent, but this won't necessarily be true in the future.

In the future, the decimals of the liquidity token may not always have 18 decimals.

Therefore, we should put the base liquidity token's decimals into an immutable variable for the purposes of the liquidity depth computation so that the incorrect number of decimals will not wreak havoc on the open interest caps.

This will take a moment of thought because to test this correctly we should deploy real erc20 contracts with the relevant decimals, but it does not look like brownie can deploy contracts at arbitrary addresses, even locally.

There is currently a calculation that depends on the ordering of addresses that is right now really just crossing its fingers as to whether the ovl/weth ordering respects the same ordering as our price feed for axs/weth.

            _ovlPrice = OracleLibraryV2.getQuoteAtTick(
                int24((_ticks[0] - _ticks[1]) / int56(int32(int(macroWindow)))),
                1e18,
                ovl,
                weth
            );

Possible solutions are to

  1. keep deploying mock erc20s until we get address hierarchies that map onto the price feeds we are consuming
  2. figure out completely how to make synthetic feeds, which I have made some progress on

I'd favor solution #2 the most there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions