Using last look to renege trades
A maker can renege on a trade if the market conditions are no longer favorable. This can be done in multiple ways, but the strat lib has made it easy by adding a __lastLook__
function which can be overridden.
You can follow the smart offer tutorial and extend it with the following function
loading...
This override of the __lastLook__
will renege if the offer is not fully taken. Note that since the provision is lost as a 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.
As an exercise, try posting an offer with a maker contract with the implementation of __lastlook__
above. Now try out targeting this offer with a snipe that takes only part of the tokens that the offer gives. The result should be a makerExecute
fail with the reason that the offer must be fully taken.
In a Foundry trace this might look something like this:
│ │ └─ ← 0x0000000000000000000000000000000000000000000000000000000000000001
│ ├─ [623] OfferMakerTutorial::makerExecute((0x63E537A69b3f5B03F4f46c5765c82861BD874b6e, 0xC87385b5E62099f92d490750Fcd6C901a524BBcA, 565, 13965252376515437924197781608061731723491045742767017537776374226616320, 100000000000000000, 170000000000000000000, 114972889140951241694864433974031885472888135242322246917362470694355803832320, 95685385232850624329487581946028423310341827134083876137913628388789126692864, 452312848583266388373324160192082719549164520795168960635552751154278432768))
│ │ └─ ← "tutorial/mustBeFullyTaken"
│ └─ ← "Custom Error 6d67762f:(0x0000000000000000000000000000000000000000, 15120238736495)"