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

Disallow integer truncation during fee assessment

alnoki opened this issue · comments

commented

General

Presently, Econia assesses fees using integer division: a global taker fee rate is defined in incentives::IncentiveParameters::taker_fee_divisor.

When taker fees are assessed via incentives::assess_taker_fees, integer division is used to calculate the assessed amount, and truncation is allowed.

To disallow truncation, the tick size for any given market would have to be checked during market registration to verify that it is an integer multiple of the global taker fee divisor.

Implications

In the present design, implementing such a check on tick size would require an additional check on any modifications to the taker fee divisor, which can be updated via incentives::update_incentives: truncation may be introduced in existing markets if a new taker fee divisor were to introduced such that the old taker fee divisor is not an integer multiple of the new taker fee divisor.

Since the taker fee divisor is hard-coded to 2000 as a genesis parameter (0.05%), this constraint in the present design, means that only possible future taker fee divisors could be 1000 (0.1%), 500 (0.2%), etc.