Skip to content

fea: add MarketFactory#147

Open
ricklista wants to merge 4 commits intomasterfrom
feature/marketFactory
Open

fea: add MarketFactory#147
ricklista wants to merge 4 commits intomasterfrom
feature/marketFactory

Conversation

@ricklista
Copy link
Contributor

📄 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:

  • add new contract src/moolah/MarketFactory.sol

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 by MarketFactory.
  • 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.

@ricklista ricklista force-pushed the feature/marketFactory branch from b107b83 to 27d10e0 Compare March 11, 2026 10:00
@ricklista ricklista force-pushed the feature/marketFactory branch 2 times, most recently from 39d9374 to dfcc813 Compare March 16, 2026 07:41
@ricklista ricklista force-pushed the feature/marketFactory branch 2 times, most recently from 4bf91ba to 1bb9246 Compare March 19, 2026 11:29
@ricklista ricklista force-pushed the feature/marketFactory branch from 1bb9246 to 2351642 Compare March 23, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants