ERC-7725: Exponential Curves

Hello :wave:
I’ve been looking into on-chain exponential curves for a while to assist in a reputation project that aims to decrease the soul-bounded governance power as time passes. Similar projects such as ENS have implemented this to decay the premium on expired names.


But every single project that strives to use exponential curves ends up using different formulas. Thus I’ve found myself developing a standard that everyone can use to easily manage exponential curves on-chain.

EXPCurves on GitHub

This smart contract implements an advanced exponential curve formula designed to handle various time-based events such as token vesting, game mechanics, unlock schedules, and other timestamp-dependent actions. The core functionality is driven by an exponential curve formula that allows for smooth, nonlinear transitions over time, providing a more sophisticated and flexible approach compared to linear models.

function expcurve(
    uint32 currentTimeframe,
    uint32 initialTimeframe,
    uint32 finalTimeframe,
    int16 curvature,
    bool ascending
  ) public pure virtual returns (int256);

The smart contract provides a function called expcurve that calculates the curve’s decay value at a given timestamp based on the initial timestamp, final timestamp, curvature, and curve direction (ascending or descending). The function returns the curve value as a percentage (0-100) in the form of a fixed-point number with 18 decimal places.

We can create up to 4 types of curves or even keep a straight line. You can play around with the curvature (k) to determine the steepness of the curve.

You can also fork this spreadsheet and play with the formula and the resulting charts.

I’m currently writing the EIP but I would like to know if this contribution was previously developed to avoid duplicated work, otherwise, let me hear what you think and what I should’ve done differently!


1 Like