# Using last look to renege trades

### Example <a href="#example" id="example"></a>

A maker can [renege](/dev/quick-links/glossary.md#renege) on a trade if the market conditions are no longer favorable. This can be done in [multiple ways](/dev/protocol/technical-references/makers/maker-contract.md), but the strat lib has made it easy by adding a [`__lastLook__`](/dev/strat-lib/technical-references/api-preferences/strats/src/strategies/mangroveoffer.md#lastlook) function which can be overridden.

You can follow the [smart offer tutorial](/dev/strat-lib/getting-started/post-a-smart-offer.md), and extend it with the following function:

OfferMakerTutorialResidual.sol

```
function __lastLook__(MgvLib.SingleOrder calldata order) internal override returns (bytes32 data) {
  data = super.__lastLook__(order);
  require(order.takerWants == order.offer.gives(), "tutorial/mustBeFullyTaken");
}
```

[See entire file on GitHub](https://github.com/mangrovedao/mangrove-strats/blob/508bc8ace7f1d2ab54397611875306dc1ec31754/src/toy_strategies/offer_maker/tutorial/OfferMakerTutorialResidual.sol#L75-L78)

This override of the `__lastLook__` will renege if the offer is not fully taken. Note that since the [provision](/dev/quick-links/glossary.md#provision) is lost as a [bounty](/dev/quick-links/glossary.md#bounty) to the taker, care must be taken to select the right circumstances to renege. This uses the mechanisms for compensating the taker on failure, and therefore the maker should [renege early](/dev/protocol/background/reneging-on-offers.md).

### Exercises[​](https://old.docs.mangrove.exchange/developers/strat-lib/guides/howToRenege#exercises) <a href="#exercises" id="exercises"></a>

1. Try posting an offer with a [maker contract](/dev/protocol/technical-references/makers/maker-contract.md) with the above implementation of `__lastlook__` above.
2. Then, try out targeting this offer with a [market order](/dev/protocol/technical-references/takers.md#market-orders) that takes only *part* of the tokens that the offer [gives](/dev/quick-links/glossary.md#gives). The result should be a `makerExecute` fail with the reason that the offer must be fully taken.

**Note :**

For your offer to be targeted by a market order, it needs to sit at the top of the order book. Make sure to choose a very favorable price (i.e. tick) when posting your offer. For an example of how to calculate a tick from a ratio, check the Solidity snippets of [Posting a new offer](/dev/strat-lib/guides/reposting-an-offer-in-the-posthook.md).

In a [Foundry](https://book.getfoundry.sh/getting-started/installation) trace, it would look like this:

```
    │   │   └─ ← 0x0000000000000000000000000000000000000000000000000000000000000001
    │   ├─ [623] OfferMakerTutorial::makerExecute((0x63E537A69b3f5B03F4f46c5765c82861BD874b6e, 0xC87385b5E62099f92d490750Fcd6C901a524BBcA, 565, 13965252376515437924197781608061731723491045742767017537776374226616320, 100000000000000000, 170000000000000000000, 114972889140951241694864433974031885472888135242322246917362470694355803832320, 95685385232850624329487581946028423310341827134083876137913628388789126692864, 452312848583266388373324160192082719549164520795168960635552751154278432768)) 
    │   │   └─ ← "tutorial/mustBeFullyTaken"
    │   └─ ← "Custom Error 6d67762f:(0x0000000000000000000000000000000000000000, 15120238736495)"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mangrove.exchange/dev/strat-lib/guides/using-last-look-to-renege-trades.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
