7Block Labs
DeFi

ByAUJay

Building a Decentralized Lending Protocol: Risk Management Logic

Getting into building a decentralized lending protocol is such an exciting adventure! But, let’s be real, it also brings along its own set of risks you’ll need to watch out for. To take on this challenge, it's really important to come up with a strong risk management strategy. Let's take a closer look at some important parts of that strategy.

Understanding the Risks

Every lending protocol comes with its own set of risks, but when you're dealing with a decentralized system, things can get a little trickier. Here’s a quick rundown:.

1. Credit Risk: Basically, it's the risk that borrowers might not be able to pay back the money they've borrowed. When it comes to decentralized finance (DeFi), figuring out this risk can be pretty tricky.

2. Smart Contract Risk: Because we're working with code, any bugs or weaknesses in the smart contracts can really hurt us financially.

3. Liquidity Risk: This is basically the chance that borrowers might struggle to sell off their collateral. When that happens, it can get really tricky to turn those assets into cash.

4. Market Risk: Cryptocurrencies can really swing up and down a lot. When the market takes a sudden nosedive, it can really shake up the value of collateral, and that puts everything on the line.

5. Regulatory Risk: The rules and regulations surrounding DeFi are still changing and developing. It's a bit of a moving target right now! New rules might affect how things run or how users get involved.

Risk Management Strategies

Alright, let’s dive into a few strategies that can really help you tackle these risks in a smart way.

1. Over-Collateralization

A great way to reduce credit risk is by asking borrowers to put up more collateral than what they actually need for their loans. It’s like having a safety net--just in case things don’t go as planned. So, what this really means is that they have to provide collateral that's worth even more than the actual loan they're taking out. This way, if they fail to pay, there’s enough collateral in place to help cover any losses.

2. Regular Audits

To manage the risks that come with smart contracts, it’s super important to have regular audits done. Having some outside experts take a look at your code is a smart move. It helps catch any potential vulnerabilities before they can be taken advantage of.

3. Automated Liquidation Mechanisms

Setting up automated liquidation processes is a smart way to handle liquidity risk. If a borrower’s collateral falls below a specific level, the system has the ability to automatically sell it off to protect the loan. This helps to minimize any losses.

4. Diversified Asset Pools

Having a mix of different assets can really help protect you from market ups and downs. If you spread your investments around instead of putting all your money into one thing, you can really cushion yourself against the ups and downs of any single asset's price. It’s all about keeping things balanced!

5. Staying Informed on Regulations

Staying on top of regulatory changes is super important when it comes to handling regulatory risk. Getting involved in industry groups and keeping up with the latest news can really help you stay on top of any possible challenges that might come your way.

Conclusion

Creating a decentralized lending protocol is definitely a big challenge, but having a solid risk management strategy in place can really help you tackle those obstacles with confidence. If you really get a handle on the risks and take the right steps, you can build a strong platform that not only serves your users well but also dodges any major pitfalls along the way.

If you’re looking for more detailed info, be sure to take a look at these resources!

Keep your wits about you and stay ready, and your lending protocol will really shine in the crazy world of DeFi!

the technical headache you’re already feeling

So, you've been fine-tuning things for those chill market vibes, right? But then, out of nowhere, you get this wobbly situation with correlated LST/LRT tokens like stETH, weETH, and ezETH. And just like that, those spreads start to get wider. Suddenly, those "safe" LTVs you were banking on? Not feeling so safe anymore! Chaos Labs dropped some interesting updates for Aave in 2025. They really emphasized how making regular adjustments to the caps and curves was super important as liquidity and utilization changed across different chains and assets. It’s fascinating to see how these little tweaks can have such a big impact! If you can’t keep up with the changes, your protocol might run into some serious financial troubles or struggle to stay ahead of the competition. (governance.aave.com).

When it comes to L2s, a little hiccup with the sequencer can really throw a wrench in the works. It can turn what should be a straightforward liquidation into a total mess, especially for folks trying to navigate through L1. Hey there! If you're not keeping tabs on a Sequencer Uptime Feed with a grace window for your price queries, you might want to reconsider. Seriously, you're just one hiccup away from those chaotic liquidations and all the governance chaos that follows. It’s worth staying ahead of that curve! (docs.chain.link).

So, it looks like your oracle stack is dependent on just one source, and that could lead to some issues down the line. So, if there’s a messed-up pool print or a TWAP that's way too short, it can drop your users' HF below 1. When that happens, their collateral might end up getting auctioned off at a lower price. Not a great situation! When you're working with the Uniswap V3 TWAP, it’s really important to have a good observation history and to do some careful calculations. A lot of people tend to trip up on this, so just keep that in mind! (docs.uniswap.org).

When gas prices shoot up, liquidations can really hit your wallet hard--like, just when you need them the most! So, Aave v3 has some pretty straightforward close-factor rules, which is great. But here's the catch: if you don’t have gas-optimized routes and private order flow, your keepers could totally miss the mark. That could leave you in a tough spot with some unwanted bad debt hanging over you. Not a fun situation to be in! (aave.com).

You know, those rate curves that look pretty stable when there's about 50% utilization can really fall apart when it hits 100%. It only takes one major whale withdrawal to send things into a tailspin. Just take a look at the adjustments made to the 2025 USDT curve; they had to tweak things to keep that volatility in check! If your interest model can’t be updated on the fly while keeping everything secure, you might find yourself either selling off too much too quickly or completely halting lending altogether. (governance.aave.com).

Hey, have you had a chance to look at those Euler postmortems? It turns out that a single unchecked pathway, specifically around the “donate to reserves” and the soft liquidation math, really threw a wrench in things and resulted in some pretty serious bad debt. Your reviewers caught on to it, but it’s your users who are going to feel the impact. (cointelegraph.com).

What Ignoring It Could Cost You

  • Missed Launch Windows: So, if we see a drop in Value at Risk (VaR) because of some correlated shocks--like ETH losing value, the LST basis widening, or stablecoins acting all weird--then procurement won't give the green light on those TVL incentives. Gauntlet points out that "broken correlation" situations are a genuine risk--it’s not just something we’re hoping for. Take a look at this: governance.aave.com. You’ll find some interesting insights there!
  • Skyrocketing Borrow Rates: When rates hit their highest point, you can bet that your best market makers might start looking for better offers elsewhere. Check out the 2025 updates for Aave and Compound; it’s wild how even the smallest mistakes with the parameters can cause all sorts of chaos. You could end up stuck at 100% utilization for days, with zero liquidity - and trust me, that can seriously hurt your reputation. You can check out more details right here: (governance.aave.com).
  • Layer 2 Outages: So, these outages can really throw a wrench in things, causing some chaotic and pretty unfair liquidations. And before you know it, your legal and communications teams are stuck untangling a “sequencer outage” during the postmortem analysis. It’s definitely not a fun situation to navigate! Hey, have you heard about sequencer-gated feeds? They’re definitely something you don’t want to ignore. If you do, you might be setting yourself up for some pretty big headaches down the line! Learn more here: (docs.chain.link).
  • Oracle Mistakes: These slip-ups can sometimes lead to endless debates in governance discussions. It's like they just keep hanging around. If you mess up with TWAP or let those outdated heartbeats slide, you could end up sharing losses you definitely didn’t sign up for. So, just a heads-up about Uniswap v4--it doesn't come with any built-in oracles. On the other hand, v3 needs you to manage observations properly. Basically, your code has to demonstrate that it can handle staleness checks and set those bounds correctly. Just make sure you're on top of that! Details here: (docs.uniswap.org).
  • MEV Issues: If you're not careful about how you broadcast liquidations--like just dumping them into the public mempool without any bundles or private routing--you could end up losing a lot of cash. You're kind of letting searchers take a free ride, but you're not really addressing your own risks. Hey, just a quick reminder--don’t overlook Flashbots Protect and MEV-Share! They can really save you some money, so make sure you’re using them. Otherwise, you might end up losing cash that you could’ve kept! Check it out for all the details: (docs.flashbots.net).
  • Liquidation Math Edge Cases: Just one quirky edge case in your liquidation calculations could end up costing you a whopping nine figures. Ouch! Check out Euler’s 2023 exploit! It really highlights how the mix of health-factor math and that “discount” logic can get pretty chaotic real quick. If you want to dig deeper, check this out: (dn.institute). There’s a lot more information waiting for you!

7Block’s Methodology to Ship a Lending Protocol That Survives Stress

When it comes to creating a lending protocol that can navigate the market's twists and turns, 7Block really has its strategy down pat. Let me give you a peek into how we do things around here:

1. Thorough Research

Before we jump in, we take a good look at the market, get a feel for what users really need, and check out the rules and regulations we need to keep in mind. By doing it this way, we can create something that truly tackles the challenges we’re facing out there.

2. Modular Design

We think it's really helpful to break stuff down into bite-sized chunks. Creating a modular setup makes it super easy for us to adjust to new needs and update individual parts without having to completely redo the entire system.

3. Rigorous Testing

We really put our protocol to the test with some intense stress tests and simulations. This lets us spot any potential hiccups or weaknesses before they turn into actual issues out there in the real world.

4. Strong Security Measures

Security is non-negotiable. We’ve got a bunch of security measures in place to keep our users and their money safe. Your peace of mind is super important to us! This covers regular check-ups and vulnerability assessments.

5. Community Feedback

We really love it when you guys reach out! Connecting with our community helps us gather awesome insights and feedback, which lets us tweak and improve things. Your input means a lot to us!

6. Continuous Improvement

The crypto scene is always buzzing with activity, just like we are! We're all about keeping things fresh and making improvements as we go. Whether it's feedback from you, new data coming in, or shifts in the market, we’re dedicated to staying on top of it all!

7. Regulatory Compliance

Staying compliant is super important. We make it a point to stay on top of the latest regulations and make sure our procedures are fully compliant with all the legal stuff. That way, our users can relax and enjoy peace of mind.

Conclusion

By following these steps, 7Block is all about building a lending protocol that not just addresses what people need right now, but also stands strong for the long haul. We’re super excited about this journey, and we can’t wait to keep you in the loop with all the updates as we go!

  1. We're focusing on parameterization that's really grounded in liquidity, not just going with the flow. We develop collateral parameters that adjust according to real market conditions, like liquidity levels, market depth, and those telltale signs that indicate different market phases.
  • Collateral/Liquidation Factors Alright, let's start by looking at some conservative CF/LF bands. These will be influenced by the on-chain depth and those previous slips we've seen. Similar to how Compound v3 works by breaking apart "collateral" and "liquidation" factors to avoid those giant liquidations when things shift, it’s a good idea to adopt this split approach yourself.
    Take a look at this: (docs.compound.finance). You’ll find some really useful info there! Hey, just a quick heads up: when you're working with isolation modes, don’t forget to establish those supply and borrow caps. It's super important that they actually match the venue’s liquidity. Aave v3 really hits the mark with its governance-enforced supply and borrow caps that get updated regularly, all thanks to the Risk Steward. It’s a smart way to keep everything in check! Make sure to keep an eye on this feedback loop--it's not a "set it and forget it" situation! To dive deeper into this, check out aave.com. It's definitely worth the read!
  • eMode/Correlated Assets Alright, here’s the deal: for those sets that are pretty interconnected, like stablecoins or ETH paired with LSTs, let’s think about giving them an eMode-like boost. This means we could offer a higher loan-to-value ratio (LTV) and go for a lower liquidation bonus to make things even sweeter.
    To stay on top of things, we'll put some correlation monitors in place and set up price dislocation thresholds for when to jump in. Aave's eMode really shows off the possibilities, and we'll be adding some circuit-breakers to manage any hiccups in correlation. Take a look at this: (aavee.guide). You'll find some cool info there!
  • Interest Rate Curves Kinked models can really stand out, especially if you know how to adjust the slopes and hit that UOptimal when things get a bit hectic. It’s a really good idea to learn from what Aave and Compound have done. Why not go with strategies that are already tried and true? We're focused on keeping those "curve toggles" safe for governance, which is why we're rolling out some timelocked changes. This way, we’ll make sure everything gets a nod of approval from our auditors before it actually goes live. Hey, take a look at this: aave.com. It's got some interesting stuff!

2) Oracle Architecture with Liveness, Bounds, and L2 Awareness

  • Main Point: We rely on Chainlink OCR feeds to monitor the "heartbeat" of each asset and catch any changes or anomalies. It’s super important to have a good updatedAt threshold set up. If things start getting outdated, we’ll automatically switch to fail-closed mode to ensure everything stays safe. Take a look at this: docs.chain.link. You’ll find some really cool info there!
  • Sequencer Guard: When it comes to Layer 2 solutions, we rely on the Sequencer Uptime Feed. We always allow a bit of a grace period after any "up" transitions. If things aren’t looking great, we hit the brakes on any operations that might be affected by price changes. If you want to dive deeper into that, check it out here: (docs.chain.link). You’ll find all the details you need!
  • Secondary: We're incorporating Uniswap v3's TWAP, and we're all about making sure we have plenty of observation points in place. Make sure that the window length is in sync with the pool's liquidity. It's a key detail you don't want to overlook! Our engineers follow the official tickCumulative math closely, and they make sure to expand the ring buffer during off-peak hours. This approach helps keep everything running like a well-oiled machine! Dive deeper here: (docs.uniswap.org).
  • Zero-Knowledge Optionality: For those longer historical windows, we use Axiom to verify the historical Uniswap TWAPs right on the blockchain. This approach lets us bypass the need for pre-caching observations, which means we can save on gas fees and steer clear of those tricky issues that come with off-chain caching. If you want to dive deeper into the topic, check it out here: blog.axiom.xyz. Trust me, it's worth a read!

Practical Snippet -- Sequencer-Aware Price Read (Solidity 0.8.x)

If you’re getting into Solidity 0, that’s awesome! There’s a lot to explore in the world of smart contracts and blockchain development. Just remember, you’ve got everything you need to get started right at your fingertips. Enjoy the journey, and happy coding! 8. Hey there! Just a quick note for those of you who are keeping an eye on price reads. This little snippet is all about the sequencer, so I hope it helps you out! It's a great way to snag prices while keeping in mind what the sequencer does.

Let’s kick things off with a simple example to help you out:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IPriceFeed {
    function getLatestPrice() external view returns (int);
}

contract PriceReader {
    IPriceFeed public priceFeed;

    constructor(address _priceFeed) {
        priceFeed = IPriceFeed(_priceFeed);
    }

    function readPrice() external view returns (int) {
        int price = priceFeed.getLatestPrice();
        
        // Check if we should be aware of sequencer
        if (isSequencerActive()) {
            // Logic if sequencer is active
            return price; // Adjust as needed based on sequencer status
        } else {
            // Logic when sequencer is inactive
            return price; // Here you might want to handle differently
        }
    }

    function isSequencerActive() internal view returns (bool) {
        // Your logic to check sequencer status
    }
}

Key Takeaways

1. Interface Use: We’ve created an IPriceFeed interface to help your contract connect with price feeds easily. 2. Price Reading: So, the readPrice function grabs the most recent price and also makes sure that the sequencer is up and running. 3. Sequencer Logic: You have the flexibility to tweak how you manage pricing, depending on where the sequencer is at.

Don't hesitate to tweak this base snippet to make it work for your project!

error StaleOracle();
error SequencerDown();
error GracePeriod();

function _checkedPrice(AggregatorV3Interface priceFeed, AggregatorV3Interface seqFeed)
    internal
    view
    returns (int256)
{
    (, int256 seqStatus, , uint256 seqStartedAt, ) = seqFeed.latestRoundData();
    if (seqStatus == 1) revert SequencerDown();
    if (block.timestamp - seqStartedAt < 3600) revert GracePeriod(); // 1h grace

    (, int256 answer, , uint256 updatedAt, ) = priceFeed.latestRoundData();
    if (block.timestamp - updatedAt > MAX_STALENESS) revert StaleOracle();

    return answer;
}

This helps us stick to Chainlink's tips for handling L2 outages, so we don't end up with stale prices throwing off our HF calculations. If you want to dive deeper into it, you can find more info here. Enjoy exploring!

3) Liquidation design that’s competitive, fair, and cheap

  • Nailing down those factors and bonuses. So, with Aave v3, it starts off with a standard 50% liquidation. But once the health factor (HF) reaches a certain point, it ramps all the way up to 100%. Pretty interesting mechanics, right? To keep everything organized and to avoid that pesky dust, just follow this step-up logic. It really helps make a difference! If you're looking to achieve Aave v4 parity, you might want to consider incorporating “target HF” repayments along with a flexible bonus slope. Take a look at the details here. You'll find all the info you need!
  • Collateral sale mechanism Compound v3 has this really neat strategy with its "storefront price factor" that offers discounts, plus it has a public buyCollateral feature to help clear out seized assets. Consider adopting a two-part strategy: go for AMM swaps when dealing with highly liquid pairs, and then switch to a discounted order book for those less popular assets. Just make sure you're gating those discounts a bit; that way, you won’t accidentally encourage any bad trading behavior. If you're looking to get more info, you can check it out here. It’s worth a look! Hey, if you’re dealing with vault-style or isolated pools that aren’t exactly swimming in liquidity, you might want to think about borrowing through Maker’s Dutch auction system, known as Clipper. The combination of (buf, tail, cusp) has really shown its value. If you're looking for more details, you can check it out here.
  • MEV-aware execution
  • Set up a first-party liquidation bot that goes through Flashbots Protect and MEV-Share. This will totally help you avoid those annoying sandwiches and grab those backrun rebates! And on top of that, with bundled composition, keepers can swap tips and snag some rebates, all while making sure those liquidation prices stay nice and reasonable. You can find all the info you need right here.

Practical Snippet -- Computing Max Collateral to Seize (Aave-style)

When you’re using Aave or platforms like it, figuring out the maximum amount of collateral that could be taken is really crucial. Here’s a quick code snippet that’ll make this a breeze for you!

def max_collateral_to_seize(borrowed_amount, collateral_price, liquidation_threshold, collateral_factor):
    """
    Calculate the maximum collateral that can be seized in a liquidation scenario.
    
    :param borrowed_amount: Amount borrowed in the underlying asset.
    :param collateral_price: Price of the collateral in the same underlying asset.
    :param liquidation_threshold: Liquidation threshold percentage (e.g., 0.8 for 80%).
    :param collateral_factor: Collateral factor percentage (e.g., 0.5 for 50%).
    :return: Maximum collateral that can be seized.
    """
    return (borrowed_amount / (collateral_factor * collateral_price)) * liquidation_threshold

# Example usage:
borrowed_amount = 1000  # Amount borrowed in the underlying asset
collateral_price = 200   # Price of the collateral in the same asset
liquidation_threshold = 0.8  # 80% liquidation threshold
collateral_factor = 0.5  # 50% collateral factor

max_collateral = max_collateral_to_seize(borrowed_amount, collateral_price, liquidation_threshold, collateral_factor)
print(f"Max collateral to seize: {max_collateral}")

Understanding the Parameters

  • borrowed_amount: This figure represents the total amount you've borrowed in the main asset.
  • collateral_price: Basically, this tells you how much your collateral is valued at, and it's measured using the same asset type.
  • liquidation_threshold: So, this typically refers to a percentage, like 80% or even 0%.
  1. This tells you when your collateral might be at risk of being taken.
  • collateral_factor: Think of this as the percentage of your collateral that's actually available for use. It's kind of like having a safety net to keep you secure.

Why is This Important?

Understanding how to calculate max collateral is super important in the DeFi world, especially if you want to keep your assets safe when things get dicey during a liquidation. It can help you avoid losing a lot more than you expected. Make sure to keep this little gem close for your DeFi coding adventures!

function maxCollateralToSeize(
  uint256 debtToCover, uint256 debtPrice, uint256 collPrice, uint256 liqBonusBps
) internal pure returns (uint256) {
  // liquidation bonus in bps e.g., 10500 => 5% bonus
  unchecked {
    return (debtToCover * debtPrice * liqBonusBps) / 10000 / collPrice;
  }
}

Take a look at your HF/close-factor strategy! It’s a good idea to choose the right debt-to-cover ratio and ensure that the bonus matches the risk for each asset. Just a little tip to keep everything in balance! (aave.com).

4) Gas Optimization Where It Matters: HF Checks, Oracle Reads, Liquidations

Techniques We Harden in Review:

  • Storage Packing for Reserve Config: Let’s dive into those bits for LTV, LT, and the bonus. Hey there! Just a quick reminder to use custom errors instead of those revert strings. It’s way cleaner! Also, don't forget to cache those prices in memory for better efficiency. And when you're working with SSTORE calls, try to batch them together--it really helps to streamline things. Happy coding! So, Solidity 0.

8. Even though version 22+ already skips some loop overflow checks, we prefer to keep our counters wrapped in unchecked. It just makes things clearer for us. (docs.soliditylang.org).

  • External Functions with Calldata: Whenever you can, try to cut down on using abi.decode. Also, don't forget to stick with immutable addresses for your feeds and pools. It really helps keep things clean and efficient! When you're diving into assembly, focus your audits on those hot paths that truly count. Don’t forget to add clear comments and set up tests to keep everything in check! (certik.medium.com).

Why It Pays:

Slashing those liquidation-call gas costs by 25-40% can totally transform the situation. It's really about having backup plans in place versus dealing with the stress of bad debt. This is a key ROI driver that really comes into play during tough times.

5) Safety Rails: Circuit Breakers and Pausability That Don't Tie You Down

Hey there! It might be a good idea to think about implementing ERC/EIP-7265-style circuit breakers for how your token outflows are managed. We should definitely tie these to on-chain metrics, like those sudden drops in TVL, any weird deviations from oracles, or even downtime on L2s. Oh, and let’s make sure to include a cooldown period too! Just a heads up, you’ll want to make sure your protocols can be easily upgraded. It’s also important to have some governance and timelock controls in place. Plus, don’t forget to create clear runbooks to guide you through everything. Take a look at this proposal for all the juicy details: (ethereum-magicians.org). You’ll find everything you need there!

  • When you're checking out your breakers, make sure to be really precise. For example, you could consider hitting pause on new loans or letting people withdraw collateral in the markets that are impacted, while still keeping the door open for repayments. This can really help you avoid those frustrating cascading losses.

Hey, make sure you take the time to write down your emergency procedures. It’s really important! The Aave and Balancer communities have been chatting a lot about breaker patterns lately, and honestly, it's been super interesting. If you’re curious, it’d be a good idea to check out those governance threads! They can give you some great tips for putting together your own playbooks in advance. Hey, check this out: (governance.aave.com). It’s a proposal about implementing EIP-7265 circuit breakers to boost the security of the protocol. Should be interesting!

6) ZK as a Force-Multiplier (Where It’s Worth It)

With Axiom, you can effortlessly verify historical TWAP windows on-chain using ZK proofs. That means no more dealing with the headache of pre-growing Uniswap observation buffers! It really takes a load off your shoulders, making integration simpler and saving you time on maintenance. Pretty neat, right? Take a look at this: blog.axiom.xyz. It's definitely worth checking out!

If you're diving into some of the tougher off-chain risk calculations, like stress testing and Value at Risk (VaR), it's a good idea to generate attestations that lock in both your scenario set and the results you come up with. You can double-check everything on-chain using a zkVM verifier, such as RISC Zero. Hey there! Just wanted to give you a quick heads up: RISC Zero is wrapping up their hosted Bonsai service and moving on to Boundless. So, if you're working on any integration plans, definitely keep that in mind! More details here: (dev.risczero.com).

7) Testing, Invariants, and Formal Verification Culture

  • Invariants: So, there are a few important ones we like to monitor. For instance, we look at “totalAssets = sum(underlying) + fees.” We also keep an eye on “no liquidation yields negative reserves,” and make sure “HF monotonicity holds when prices are scaled equally.” "So, we usually roll with Foundry’s invariant framework. When it comes to static analysis, we like to use Slither, and for property fuzzing, we lean on Echidna. It's a solid combo!" Take a look at it over on GitHub! You might find it really interesting.
  • Formal Methods: We're all about making sure we nail the essential stuff, like preventing undercollateralized borrowing and keeping an eye on liquidation profits. We use Certora-style rules to help us with that. Aave's modules have been verified by Certora Prover several times, which is a reliable benchmark for ensuring your core math is on point. If you're looking for more info, check out Certora! They've got some great details waiting for you there.

Context

Looks like the ETH markets are starting to tighten up a bit. We’re noticing that the gap between ezETH and weETH is getting wider. We're aiming to keep our utilization rates around 90% to 93%. The goal is to do this without having to push our borrowing up to 100%.

Step 1: Check Your Liquidity. Alright, let’s kick things off by checking out the liquidity situation. Could you check out the slippage for 1-5k units of both ezETH and weETH at the major exchanges? Thanks! Don’t forget to keep track of the depth and slippage panels, just like how Chaos Labs shares in their public updates for Aave. It's super helpful to stay in the loop! Feel free to take a look at this link: (governance.aave.com). It’s worth checking out!

  • Step 2: Adjust Those Settings a Bit. **. Alright, here’s the plan: we should go ahead and cut the ezETH supply cap by 25% if we notice that the top two suppliers are hoarding over 90% of it. But let's leave the wstETH cap alone for now. Check out the details right here: governance.aave.com. It's all laid out for you! Alright, so here’s the plan: we’re going to give UOptimal a little boost for WETH by 1% during the outflows, just for a bit. On the other hand, we should consider lowering Slope2 for the stressed stablecoin market. This could help smooth out those rate spikes. Once the inflows start coming back in, we can switch things back to how they were before--just kind of mirroring those stabilized conditions we had. More info here: (governance.aave.com).
  • Step 3: Oracle Safeguards.

Alright, let’s dive into the Oracle Safeguards! Here’s where you’ll want to get familiar with all the ways Oracle keeps your data protected and secure. They have some pretty solid measures in place to ensure everything runs smoothly. You’re going to want to pay attention to these details because they really matter in keeping your information safe! **. If the Sequencer happens to go down or is in grace mode, we'll have to hit pause on new borrows and liquidations for the L2 markets. But don’t worry, we can still keep things rolling for repayments and top-ups! For more info, just hop over to this link: docs.chain.link. You'll find plenty of helpful guidance there! Hey, just a quick reminder that we should definitely validate the TWAP using Axiom proofs when those observation windows go beyond the on-chain ring buffer. It’s super important to keep everything in check! If you want to dive deeper into that topic, check it out here: blog.axiom.xyz. It's definitely worth a read!

  • **Step 4: Time to Get Those Liquidations Rolling! **. Hey, let’s go ahead and route this through Protect/MEV-Share. We should also share the transaction hash hints so we can enable those backruns and snag those rebates! By doing it this way, we can ensure that the net cost for each liquidation remains profitable, even when we factor in those pesky gas fees. If you want to dive deeper into that, check this out: (docs.flashbots.net). It’s a great resource!

Governance-Ready Change Set (Pseudo-Config)

When we chat about governance-ready change sets, we're really getting into the nitty-gritty of some key configurations. These are essential for keeping everything running smoothly and making sure we stay compliant with all the necessary rules. Here’s a straightforward example of how this could play out.

Key Components

  • Change Management Policies: It’s important to set up some straightforward policies that outline how we suggest, review, and implement changes. This way, everyone knows the process and we can keep things running smoothly!
  • Approval Workflows: Create workflows that need certain approvals before any changes can be made live. This really helps to keep everything organized and running smoothly.
  • Documentation Standards: It's super important to keep everything documented whenever there are changes. This way, things stay clear and easy to look back on when you need to.

Sample Configuration

Alright, here’s a straightforward pseudo-config to help you wrap your head around how to set up a governance-ready change set. Check it out!

# Governance Ready Change Set
{
  "change_request": {
    "id": "CR-1234",
    "description": "Update API authentication method",
    "requester": "john.doe@example.com",
    "created_at": "2023-10-01T12:00:00Z",
    "status": "Pending Approval",
    "approvals": [
      {
        "approver": "jane.smith@example.com",
        "approved_at": null
      }
    ],
    "documentation": {
      "link": "https://docs.example.com/changes/CR-1234",
      "version": "1.0.0"
    }
  }
}

Important Considerations

1. Version Control: Make sure to keep an eye on the various versions of your updates. It's super helpful! That way, if something doesn’t go as planned, you can easily take a step back. 2. Audit Trails: Keep track of who made changes and when they happened. It's super helpful for staying on top of things! This really helps keep things on track and makes sure we stick to the rules during audits. 3. Regular Check-Ins: Make it a point to have regular check-ins on your change management process. This way, you can keep things fresh and make sure everything’s still working smoothly and staying current.

By sticking to this structure, you’ll not only ensure that your change sets are ready for governance, but you'll also make the whole process of implementing changes a lot smoother and more responsible!

{
  "market": "WETH-Core",
  "params": {
    "uOptimal": {"from": 0.92, "to": 0.93, "ttlBlocks": 54000},
    "slope1": {"from": 0.027, "to": 0.029, "ttlBlocks": 54000}
  },
  "riskCaps": [
    {"asset": "ezETH", "supplyCap": {"from": 50000, "to": 37500}, "reason": "concentration>90% & >5% slippage/2k"}
  ],
  "oracle": {
    "sequencerGrace": 3600,
    "maxStalenessSec": 1800,
    "twapWindowSec": 900,
    "axiomProof": true
  }
}

It's kind of like what Aave and Compound do with their processes for updating interest rates and caps, but here, we're stepping things up a bit. This approach automates the checks and rollbacks before any changes are actually implemented, making everything run smoother and reducing the chances of hiccups. Feel free to take a look at it here: (governance.aave.com).

What “Good” Looks Like in GTM Metrics

We love to create our pilots with clear, measurable outcomes in mind.
Here’s a quick rundown of the usual goals we try to hit in about 60 to 90 days:

  • Risk containment We were able to reduce the VaR (95%) by about 25-40% during those tough “broken correlation” stress tests, and the best part? We did it without really dropping our utilization rates. We really took the time to compare everything to what the community expects. (governance.aave.com). You’ll be happy to know our liquidation coverage ratio is really solid! We’ve managed to clear over 99% of eligible positions within the target blocks, even when things get a bit crazy with those wild spikes in volatility. We pulled this off by using gas-optimized routes and private routing. (docs.flashbots.net).
  • Capital efficiency We've managed to keep our usage right in that sweet spot, hanging around 88 to 93%. Also, the way the rates fluctuate is way easier to handle. That’s all thanks to our Aave/Compound-style slope and UOptimal strategies! Check it out here. We've been focused on minimizing collateral concentration risks, so now the two biggest suppliers account for less than 70% of our total. You can find all the details about this cap tuning right on our on-chain dashboards. If you want to dive deeper into the details, check it out here!
  • Let's talk about Operational and Gas ROI. We're expecting to see a hefty drop in gas costs--around 25-40%--when it comes to liquidation and critical paths for high-frequency trades. We pulled this off by using some smart packing techniques for storage, setting up custom error handling, and reducing the amount of SSTORE operations. Oh, and I can’t stress enough how awesome the compiler and community optimization tips have been! Seriously, they’ve made a big difference. You can check them out here: docs.soliditylang.org.
  • We've really nailed it with our oracle incident rate--it’s almost non-existent! We've put solid safeguards in place for all our price reads, keeping an eye on staleness and the status of the L2 sequencer. Plus, when any incidents do happen, we make sure to stick to our documented runbooks to handle things smoothly.
    (docs.chain.link).

How We Deliver (and How Procurement Says “Yes”)

  • Discovery and Design (2-3 weeks): We start by digging deep into a solid threat model. We'll also take a close look at liquidity profiles for each asset and chain, and get our oracle/MEV architecture all set up. We've also set some parameter bands and put together emergency procedures just in case. In this phase, we're working on putting together a basic risk engine and some governance adapters.
  • Build Sprints (4-8 weeks): We're going to dive into the core of the protocol and the liquidation engine, making sure they're decked out with gas-optimized hot paths and some sleek private routing. Oh, and we're also going to include the risk steward module to help us keep track of any changes to the parameters. Hey there! Just wanted to give you a quick heads-up about our oracle module. It's going to include Chainlink, a TWAP fallback, and a sequencer guard. Plus, we've got the option to throw in Axiom TWAP proofs if that's something you’re interested in. Pretty exciting stuff! We're going to dive straight into using invariants, fuzz testing, and formal specs right from the get-go. From day one, our auditors are right there with the team--none of that “throw it over the wall” nonsense around here! We believe in collaboration from the get-go.
  • Pilot (4-8 weeks): In this phase, we’ll kick things off by setting up some capped markets. We’ll also roll out alert systems, create user-friendly dashboards, and work on integrating those go-to-market strategies specifically for market makers and integrators. It’s all about laying a solid foundation for what’s to come!
  • Procurement Outcomes:
  • With our smooth processes and reliable controls in place, we’ve noticed that our audit times are getting shorter and our listing cycles are speeding up.
  • We've got some ROI calculations that your CFO is definitely going to love! With our gas/MEV-aware logic, you can look forward to improved net interest margins from narrower utilization bands, less bad debt hanging around, and lower keeper subsidies. Sounds good, right?

Where 7Block Fits In

Looking for a full build? Our awesome teams specialize in web3 development services and custom blockchain development services! We create reliable, audited, and gas-efficient lending stacks that you can absolutely trust.

Got your project off the ground but worried about potential bumps in the road? Don’t stress! With our security audit services, we’ve got your back. We’ll take a close look at the liquidation math, oracle gating, and MEV paths so you can rest easy knowing you’re all set.

Want to seamlessly connect with your existing liquidity and custodial systems? Our talented blockchain integration team has got you covered! We handle everything from building bridges and setting up price adapters to managing back-office reconciliation, ensuring that your operations run without a hitch.

Thinking about kicking off a new money market or maybe a standalone pool? Be sure to explore our DeFi development services and smart contract development options. We've got some pretty solid solutions for you!

Emerging Best Practices to Adopt in 2026-Grade Builds

  • **Being able to adjust parameters is really important. Why not follow Aave’s lead with their Risk Steward strategy? It’s all about making those small, regular adjustments to caps and curves, and they do it using some really solid on-chain data and concentration metrics. Keeps things fresh and efficient! Oh, and just a quick reminder--make sure you set up those dashboards before you start handing out any incentives! (governance.aave.com).
  • It’s super important to have L2-aware oracles. Just a heads-up: it’s super important to make sure that every L2 market is following the sequencer grace rules. And hey, let’s keep things open and honest about the policy too! (docs.chain.link).
  • **TWAP: If you're not going to do it properly, it’s probably better to skip it altogether. You’ve got two options: either ramp up your observation capabilities or use ZK to take a look at those historical windows (that’s Axiom for you!). (docs.uniswap.org).
  • Liquidations need to be both a good way to make money and kept under wraps. Hey, have you thought about using Protect/MEV-Share along with those bundle hints? It’s worth it! Just make sure to keep track of the keeper fill rates and any rebates you might get. It's pretty important! (docs.flashbots.net).
  • **Keep ZK realistic. Just make sure to only put this into action when it really helps reduce ongoing risks--like when you’ve got solid historical data to back it up. Let’s not let this just become another buzzword, okay? If you're dealing with those more intense off-chain proofs, get excited for what’s coming after Bonsai--it's called Boundless! (docs.boundless.network).
  • **Make sure to set up circuit breakers that are specific, easy to track, and have time limits. Hey, remember to stick to the EIP-7265 guidelines, and don't forget to share your playbook ahead of time! It’s way better to have it out there than to scramble when things get tough. Trust me on this one! (ethereum-magicians.org).

So, if you're diving into the world of creating or refining a lending protocol in 2026, keep this in mind: it’s really not just about coming up with some flashy new calculations. The key to success really comes down to having a solid understanding of risk, paired with real-time liquidity. Make sure to use gas-efficient liquidation systems and dependable oracles that can handle any hiccups on L2. You don't want to be left high and dry when things get a little shaky! That’s where 7Block steps in! We’re here to help you create, audit, and collaborate every step of the way.

CTA: Book Your DeFi Risk & Gas Optimization Review

Notes and References

  • Aave Mechanics: Take a look at their interest curves, caps, and liquidations, and don't miss the new v4 liquidation engine. If you're curious and want to explore more, just click here for a deeper dive!
  • Compound v3 (Comet): They've got some cool things going on with the liquidation storefront, factor splits, and their approach to managing the IR curve. It’s definitely worth checking out if you're into that! If you’re looking for more info, you can check it out here.
  • Chaos Labs Risk Steward Proposals: So, these proposals really highlight just how adaptable operational parameters can be. I mean, when it comes to things like caps and curves, there’s a lot of room to play around! Check them out here.
  • Oracle Tips: If you’re diving into Chainlink, make sure to check out their data feeds and sequencer uptime feeds. You won’t want to overlook those! Hey, just a heads up, you might want to check out the Uniswap v3 TWAP documentation. They’ve included some important cautionary notes that are definitely worth a look! You can check everything out right here.
  • ZK for Historical State/TWAP: You should definitely check out Axiom! They've got some cool stuff going on with their zkVM verification stacks, like RISC Zero. Feel free to check out the status of Bonsai/Boundless right here. It's a handy resource!
  • MEV-Aware Liquidations and Private Routing: Interested in Flashbots Protect and MEV-Share? Check out their documentation; it’s got all the details you're looking for! Learn more here.
  • Euler Exploit Analyses: Make sure to check out our deep dive into the liquidation math interaction and the donateToReserves issue. You won't want to miss this breakdown! It's all detailed here.

Whether you've got your sights set on something specific like oracle gating, a liquidation engine, or governance adapters, or maybe you need a complete full-stack solution, we're here to help you out! We're going to take your specific needs into account and launch a pilot that highlights utilization, VaR, and gas KPIs. Once we see how that goes, we can expand it as necessary.

Get a free stress test of your tokenomics

Submit your token model and our economist will stress-test it for inflation spirals, vesting cliffs and governance capture.

Related Posts

DeFi

ByAUJay

Setting Up KYC/KYT Hooks for Institutional DeFi Protocols

### Summary Institutional DeFi is on the verge of something exciting with a straightforward way to achieve “compliant by design” liquidity. By combining Uniswap v4 Hooks with verifiable KYC credentials and on-chain KYT attestations, we can ensure that policy is enforced right when trades happen, all while keeping personal information under wraps. Check out the details below!

DeFi

ByAUJay

Building Yield Strategies with Cross-Chain DeFi Apps

> Summary: Cross-chain DeFi has come a long way! We’ve shifted from those patchy bridging solutions to more powerful, enterprise-level interoperability. In this guide, we’ll take decision-makers on a journey to craft multi-chain yield strategies using today’s top-notch tools, like CCTP v2.

DeFi

ByAUJay

Auto Unwrap (Sidechains): Simplifying Cross-Chain DeFi Apps for Everyone Have you ever found yourself frustrated with DeFi apps that work across different blockchains? You're not alone. That's where Auto Unwrap comes in! This cool feature really streamlines the process and makes using cross-chain DeFi applications a whole lot easier. Imagine seamlessly switching between different blockchains without the usual headaches. Auto Unwrap handles all the complicated stuff in the background, so you can focus on what really matters--your DeFi experience! Whether you're swapping tokens or managing liquidity, this makes life so much smoother. In short, Auto Unwrap is all about breaking down barriers and making cross-chain interactions more user-friendly. Say goodbye to the technical jargon and complicated steps, and hello to a more straightforward way to engage with DeFi apps! It’s the future of finance, and it’s looking pretty bright.

Auto-unwrap is a super useful design feature that effortlessly transforms bridged or wrapped assets back into their original, usable formats on the destination chain. Plus, it even helps with covering gas fees and combining steps, making it easy for users to carry out cross-chain actions with just one click. It’s really all about simplifying the process!

7BlockLabs

Full-stack blockchain product studio: DeFi, dApps, audits, integrations.

7Block Labs is a trading name of JAYANTH TECHNOLOGIES LIMITED.

Registered in England and Wales (Company No. 16589283).

Registered Office address: Office 13536, 182-184 High Street North, East Ham, London, E6 2JA.

© 2026 7BlockLabs. All rights reserved.