---
description: Create permissionless markets
---

# Bucket config

`createMarket`  is used in creating  permissionless markets :&#x20;

```solidity
function createMarket(MarketParams memory marketParams) external {
    Id id = marketParams.id();

    // Ensure that Interest Rate Model (IRM) and Liquidation Loan-To-Value (LLTV) are enabled.
    require(isIrmEnabled[marketParams.irm], ErrorsLib.IRM_NOT_ENABLED);
    require(isLltvEnabled[marketParams.lltv], ErrorsLib.LLTV_NOT_ENABLED);

    // Ensure that the market has not been created before.
    require(market[id].lastUpdate == 0, ErrorsLib.MARKET_ALREADY_CREATED);

    // Set the last update timestamp for the market.
    unchecked {
        market[id].lastUpdate = uint128(block.timestamp);
    }

    // Store market parameters.
    idToMarketParams[id] = marketParams;

    // Emit an event to signal the creation of the market.
    emit EventsLib.CreateMarket(id, marketParams);
}
```

`Bucket config` :&#x20;

```typescript
loanToken
collateralToken
oracle
irm
lltv
```





