# LinearAuction

The `LinearAuction` fee module creates a reverse dutch auction upon time of execution of a job. The input bytes to the `onCreateJob` function should follow the structure:

```solidity
address executionFeeToken;
uint256 minExecutionFee;
uint256 maxExecutionFee;
```

The `executionFeeToken` field is the token which execution fee will be paid in. During the auction period, the execution fee will grow linearly every second from `minExecutionFee` to `maxExecutionFee`.

<figure><img src="https://2488988847-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FotYFhyxmfp3Clnu5Ko5Q%2Fuploads%2FEDHKZSiyhDgpFQe90KHB%2FlinearAuctionChart.png?alt=media&#x26;token=7b430256-3465-48ee-9951-d4dab7699c08" alt="" width="563"><figcaption><p>Abstract graph of the fee function.</p></figcaption></figure>

More precisely, the execution fee can be calculated as follows, where *t* is the number of seconds the job is within the execution window:

$$
fee(t) = \frac{(maxFee  - minFee) }{executionWindow - 1} \cdot (t - executionTime) + minFee
$$

Here $$fee(t)$$ is the execution fee and  $$t$$ is the UNIX time in seconds of the execution (measured as `block.timestamp` in the contract). This is not to be confused with $$executionTime$$ which is the time from which the job can be executed.
