What is the Strat Library?
Last updated
Last updated
The Mangrove strat library is a repository of Solidity code that will help you write a custom able to post on Mangrove.
The strat library provides several good starting points for writing your own custom maker contract for providing liquidity on Mangrove, but the library should be used responsibly.
Note : The repository is separate from .
The strat library is open source, and is provided freely to the community as a starting point for writing maker contracts. However, do note that the strat library as a whole may still contain bugs, and should be used responsibly and with care (see also ).
If you have questions about how to use the Strat library, which are not answered sufficiently in this documentation, do reach out on the Mangrove . And pull requests to the strategy library are, of course, welcome!
Depending on the complexity of the your contract implements, you need to choose from which building block you will start to build your from. At the very least your logic must provide an implementation of the interface .
However, we suggest utilizing the building blocks in the strat lib. The first design choice is to decide whether owning offers posted by your contract is the sole privilege of the contract's admin or whether your contract's logic wishes to support multiple offer owners, in a permissionless fashion. In the first case, you want your contract to inherit Direct, in the latter you want to start from a Forwarder contract which has a pre-established code infrastructure to handle multiple ownership.
To get an idea of what it is all about, you can try out the smart offer tutorial to make a simple Direct
maker contract.
Default behavior of maker contracts built on top of Mangrove's strat library can be modified by overriding various , see for some concrete examples.
Writing a maker contract that will post and update offers on Mangrove exposes you to smart contract risks. We recommend reading some important developer guidelines on the topic to understand better important design principles you should follow.
The strat library also provides and example of contracts, which are convenient when the offer logic of your maker contract handles multiple offer owners funds or involves some interaction with other DeFi bricks (such as a lender).