[x] New reactor, order type, and decay library to support non-linear block-based decay
[x] Util lib
[x] Util tests
[x] NonLinearDecay Tests
[x] Reactor tests
Some notable differences from Dutchv2 Orders:
Instead of an uint256 endAmount, input and output use a NonLinearDecay curve struct, which defines the relative points on the decay curve. The points are relative so that the cosigner only needs to override the startAmount and the user’s signed curve can remain unchanged.
We use uint16 to store the relative block numbers. With 16 bits, we can define curves with points far into the future (11 days on Arbitrum and 1.5 years on Mainnet). If we were to use 8 bits, we could only define curves with 64 seconds into the future on Arbitrum.
NonLinearDutchInput now contains a maxAmount property to hold the max point on the input curve. Used for constructing the InputToken object for Permit2.
Some notable differences from Dutchv2 Orders:
uint256 endAmount
, input and output use aNonLinearDecay curve
struct, which defines the relative points on the decay curve. The points are relative so that the cosigner only needs to override thestartAmount
and the user’s signed curve can remain unchanged.uint16
to store the relative block numbers. With 16 bits, we can define curves with points far into the future (11 days on Arbitrum and 1.5 years on Mainnet). If we were to use 8 bits, we could only define curves with 64 seconds into the future on Arbitrum.NonLinearDutchInput
now contains amaxAmount
property to hold the max point on the input curve. Used for constructing theInputToken
object for Permit2.