econia-labs / econia

Hyper-parallelized on-chain order book for the Aptos blockchain

Home Page:https://econia.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove global fee rate values and set all fee rates on a per market basis

bogberry opened this issue · comments

Currently, there is a fee divisor that is set to 2000 globally for all markets. There should not be any global fee parameters, and all fee rates should be defined on a per market basis.

As discussed in #329, fee rates should be checked against the lot size and the tick size of the market so that any fee calculations do not result in rounding of integer values and discrepancies when comparing the amount of fees that theoretically should be collected to the amount actually collected.

However, because this rate is set globally, this condition must be met for all lot size / tick size combinations across all markets, limiting the values at which we can set fee rates. As we do not wish to impose this constraint, in practice this prevents us from eliminating the accounting errors that may occur as a result of this implementation. There is no rationale for setting this value globally, and switching to setting all fee rates per market would give users additional flexibility in addition to resolving this issue.

Finally, fee rates should not be set as a divisor. This makes it difficult to set a fee of, for example, 0.3%.