Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new MarketFactory contract to streamline market creation by batching Moolah market creation and related configuration (liquidation whitelist, supply whitelist, providers, and integrations), along with tests and supporting interfaces/mocks.
Changes:
- Added
src/moolah/MarketFactory.sol(UUPS upgradeable) to create and configure one or more markets in a single call. - Added new interfaces for external integrations (
IBuyBack,IListaAutoBuyBack,IListaRevenueDistributor) used byMarketFactory. - Added Foundry tests (
MarketFactoryTest) plus mocks to validate common, smart-provider, and special-provider (WBNB/slisBNB) market creation paths.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/moolah/MarketFactory.sol | New factory contract that creates markets and configures whitelists/providers and integration contracts. |
| src/moolah/interfaces/IBuyBack.sol | New interface used by MarketFactory to whitelist loan tokens in the buyback contract. |
| src/moolah/interfaces/IListaAutoBuyBack.sol | New interface used by MarketFactory to whitelist loan tokens in the auto-buyback contract. |
| src/moolah/interfaces/IListaRevenueDistributor.sol | New interface used by MarketFactory to whitelist loan tokens in the revenue distributor. |
| src/liquidator/ILiquidator.sol | Extended interface with tokenWhitelist + smart-provider whitelist functions used by MarketFactory. |
| src/liquidator/IPublicLiquidator.sol | Extended interface with smart-provider whitelist functions used by MarketFactory. |
| test/moolah/MarketFactoryTest.sol | New tests covering common markets, smart-provider markets, and WBNB/slisBNB provider wiring. |
| test/moolah/mocks/MockBuyBack.sol | Mock buyback used by tests. |
| test/moolah/mocks/MockLiquidator.sol | Mock liquidator/public liquidator used by tests. |
| test/moolah/mocks/MockListaAutoBuyBack.sol | Mock auto-buyback used by tests. |
| test/moolah/mocks/MockListaRevenueDistributor.sol | Mock revenue distributor used by tests. |
| test/moolah/mocks/MockProvider.sol | Mock provider with TOKEN() used for WBNB/slisBNB provider wiring tests. |
| test/moolah/mocks/MockSmartProvider.sol | Mock “smart provider” used as an oracle/provider in smart-collateral tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b107b83 to
27d10e0
Compare
39d9374 to
dfcc813
Compare
razww
reviewed
Mar 16, 2026
razww
reviewed
Mar 16, 2026
4bf91ba to
1bb9246
Compare
1bb9246 to
2351642
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📄 Description
MarketFactory supports quick creation of markets.
🧠 Rationale
Currently, creating a market requires extensive multi-signature operations, which involves heavy workload. Using MarketFactory makes market creation very simple.
🧪 Example / Testing
forge test --match-contract MarketFactoryTest -vvv
🧬 Changes Summary
Notable changes: