delvtech / hyperdrive

An automated market maker for fixed and variable yield with on-demand terms.
Apache License 2.0
33 stars 4 forks source link

Operational Documentation #615

Open jalextowle opened 1 year ago

jalextowle commented 1 year ago

We need to write documentation that provides guidance on how potential footguns that deployers and users of Hyperdrive could face in extreme situations. Some important examples are:

  1. Pauses
  2. Negative Interest
  3. Parameters for tokens with different decimals.
  4. Gaps in checkpoints.
  5. Upgrading factory parameters.
  6. Upgrading the factory implementation and data provider.
jalextowle commented 1 year ago

A concern that came up tonight is that allowing minimum transaction amounts for low decimal tokens like USDC and WBTC can be dangerous because the base paid for shorts can be rounded down with significant dollar amounts.

jrhea commented 1 year ago

A concern that came up tonight is that allowing minimum transaction amounts for low decimal tokens like USDC and WBTC can be dangerous because the base paid for shorts can be rounded down with significant dollar amounts.

in ERC4626Validation:test_OpenShortWithShares(), we test that the realized rate of a short deposit is greater than the market rate prior to the short being opened. I found that this doesn't hold true with non standard decimals. For example, at 5% fixed rate and the minimum transaction amount of 0.001, with 18 decimals we have:

shortAmount: 1000000000000000 (0.001e18)
basePaid:      47619051304917

with 6 decimals we have:

shortAmount: 1000 (0.001e6)
basePaid:      47

There is just not enough decimal places of accuracy to make this statement If we make the minimum transaction amount 1e6, then it works great.