Using last look to renege trades
Last updated
Last updated
A maker can on a trade if the market conditions are no longer favorable. This can be done in , but the strat lib has made it easy by adding a function which can be overridden.
You can follow the , and extend it with the following function:
OfferMakerTutorialResidual.sol
This override of the __lastLook__
will renege if the offer is not fully taken. Note that since the is lost as a 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 .
Try posting an offer with a with the above implementation of __lastlook__
above.
Then, try out targeting this offer with a that takes only part of the tokens that the offer . 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 .
In a trace, it would look like this: