ReferenceGas Estimates

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

ContractDeployment 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)

FunctionMinAvgMax
depositCollateral119,916195,357205,416
borrow710,729888,0331,946,511
repay (partial)74,05594,730111,055
repayFull262,739353,872602,898
claimFunds38,15138,15138,151
liquidate (trigger)43,909354,668458,255
settleLiquidation317,615317,615317,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

FunctionMinAvgMax
submitOffer22,628490,557545,748
cancelOffer74,99379,84384,693
cleanupExpiredOffers113,208113,208113,208

Liquidator Operations

FunctionMinAvgMax
placeBid107,160107,168107,172
settleAuction342,563342,577342,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:

FunctionAvg
getTotalOwed13,018
getCollateralRatio30,808
isHealthy32,891
getMaxBorrowable36,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