Gas Estimates
Gas usage for RevvFi’s core operations, measured directly from the Foundry test suite’s --gas-report output (forge test --gas-report) rather than theoretical estimates.
Deployment Costs
| Contract | Deployment Gas |
|---|---|
| RevvFiMarket (implementation) | ~3,159,573 |
| RevvFiOfferBook (implementation) | ~1,740,746 |
| RevvFiLiquidator | ~1,282,495 |
| RevvFiLiquidityQueue (implementation) | ~1,214,658 |
RevvFiFactory.deployMarket() (which clones a Market + CollateralEscrow + OfferBook + LiquidityQueue as EIP-1167 minimal proxies, then wires and registers them) costs ~1,283,727 gas end to end — dramatically cheaper than deploying full contract bytecode per market, since each clone is ~100 bytes pointing at a shared implementation.
Core Operations (RevvFiMarket)
| Function | Min | Avg | Max |
|---|---|---|---|
depositCollateral | 119,916 | 195,357 | 205,416 |
borrow | 710,729 | 888,033 | 1,946,511 |
repay (partial) | 74,055 | 94,730 | 111,055 |
repayFull | 262,739 | 353,872 | 602,898 |
claimFunds | 38,151 | 38,151 | 38,151 |
liquidate (trigger) | 43,909 | 354,668 | 458,255 |
settleLiquidation | 317,615 | 317,615 | 317,615 |
borrow’s wide range reflects the number of offers it has to walk through to fill the request — filling from one large offer is far cheaper than assembling the same amount from many small ones. repayFull’s range similarly scales with the number of active positions being settled at once.
OfferBook Operations
| Function | Min | Avg | Max |
|---|---|---|---|
submitOffer | 22,628 | 490,557 | 545,748 |
cancelOffer | 74,993 | 79,843 | 84,693 |
cleanupExpiredOffers | 113,208 | 113,208 | 113,208 |
Liquidator Operations
| Function | Min | Avg | Max |
|---|---|---|---|
placeBid | 107,160 | 107,168 | 107,172 |
settleAuction | 342,563 | 342,577 | 342,606 |
Read-Only (View) Calls
View calls cost nothing when called off-chain (via eth_call), but are listed here since some are invoked internally by state-changing functions:
| Function | Avg |
|---|---|
getTotalOwed | 13,018 |
getCollateralRatio | 30,808 |
isHealthy | 32,891 |
getMaxBorrowable | 36,589 |
Converting to Cost
estimated cost = gas used × gas price (in ETH) × native token price (USD)For a testnet deployment (Sepolia), gas price is negligible and paid in test ETH from a faucet — see Deployment for the full testnet setup. Real mainnet cost estimates depend entirely on which network RevvFi is ultimately deployed to and that network’s prevailing gas price at the time; rather than publish a number that will immediately go stale, use the gas figures above directly with your target network’s current gas price.
Next Steps
- Review Reference Overview for constants and error codes
- Check Deployment for testnet setup and network config