Admin

Complete API reference for Lotus admin functions covering ownership transfer, fee configuration, IRM/LLTV/liquidation module enablelists, and market hooks.

The Lotus protocol has a single admin address (owner) that controls global configuration and per-market settings. All admin functions revert with NotOwner if called by any address other than the current owner. Market creation is permissionless but gated by the enablelists the admin manages.

Ownership

owner()

Returns the current admin address.

  • Parameters: none

  • Returns: address

setOwner(address newOwner)

Transfers admin authority to a new address.

Parameter
Type
Description
Required

newOwner

address

Address of the new admin

Yes

  • Reverts:

    • NotOwner — caller is not the current owner

    • OwnerAlreadySet(newOwner)newOwner is already the current owner

  • Events: OwnerSet(address indexed newOwner)

Fee Configuration

feeRecipient()

Returns the address that receives protocol fees via supply share inflation.

  • Parameters: none

  • Returns: address

setFeeRecipient(address newFeeRecipient)

Sets the protocol fee recipient address.

Parameter
Type
Description
Required

newFeeRecipient

address

Address to receive future fee shares

Yes

  • Reverts:

    • NotOwner — caller is not the current owner

    • FeeRecipientAlreadySet(newFeeRecipient)newFeeRecipient is already the current fee recipient

  • Events: FeeRecipientSet(address indexed newFeeRecipient)

setFee(MarketParams memory marketParams, uint256 trancheIndex, uint128 newFee, bytes calldata irmData)

Sets the protocol fee fraction for a specific tranche. The function accrues interest for the entire market before applying the new fee so the change takes effect on up-to-date state.

Parameter
Type
Description
Required

marketParams

MarketParams

Market configuration identifying the target market

Yes

trancheIndex

uint256

Index of the tranche to update (0 = most senior)

Yes

newFee

uint128

New fee fraction in WAD (e.g., 0.10e18 = 10%)

Yes

irmData

bytes

Opaque data forwarded to the IRM during interest accrual

Yes (pass "" for default)

  • Constraints: newFee <= MAX_FEE where MAX_FEE = 0.25e18 (25%)

  • Reverts:

    • NotOwner — caller is not the current owner

    • MarketNotCreated(id) — market does not exist

    • InvalidTrancheIndex(trancheIndex) — tranche index out of range

    • FeeAlreadySet(id, trancheIndex, newFee) — fee is already set to this value

    • InvalidFee(newFee)newFee exceeds MAX_FEE

  • Events: FeeSet(Id indexed id, uint256 indexed trancheIndex, uint128 newFee)

Enablelists

Enablelists are one-way allowlists. Once an IRM, LLTV, or liquidation module is enabled, it cannot be disabled. Enablelists gate which components can be used when creating new markets.

enableIrm(address irm)

Enables an IRM implementation for use in future markets.

Parameter
Type
Description
Required

irm

address

Address of the IRM contract

Yes

  • Reverts:

    • NotOwner — caller is not the current owner

    • IrmAlreadyEnabled(irm) — IRM is already enabled

  • Events: IrmEnabled(address indexed irm)

enableLltv(uint256 lltv)

Enables an LLTV value for use in future market tranches.

Parameter
Type
Description
Required

lltv

uint256

LLTV value in WAD (1e18 = 100%)

Yes

  • Constraints: 0 < lltv <= 1e18

  • Reverts:

    • NotOwner — caller is not the current owner

    • LltvAlreadyEnabled(lltv) — LLTV is already enabled

    • InvalidLltv(lltv) — value is zero or exceeds WAD

  • Events: LltvEnabled(uint256 indexed lltv)

enableLiquidationModule(address liquidationModule)

Enables a liquidation module implementation for use in future markets.

Parameter
Type
Description
Required

liquidationModule

address

Address of the liquidation module contract

Yes

  • Reverts:

    • NotOwner — caller is not the current owner

    • ZeroAddressliquidationModule is the zero address

    • LiquidationModuleAlreadyEnabled(liquidationModule) — module is already enabled

  • Events: LiquidationModuleEnabled(address indexed module)

Market Creation

createMarket(MarketParams memory newMarketParams, bytes calldata irmParams, bytes calldata liquidationParams)

Creates a new market with the given parameters. Market creation is permissionless — any address can call this function, but all components must be pre-approved via the enablelists. The function initializes the IRM and liquidation module for the new market and assigns a deterministic market ID.

Parameter
Type
Description
Required

newMarketParams

MarketParams

Market configuration (see struct below)

Yes

irmParams

bytes

Encoded initialization parameters for the IRM

Yes

liquidationParams

bytes

Encoded initialization parameters for the liquidation module

Yes

MarketParams struct:

Field
Type
Description

loanToken

address

ERC-20 loan token for the market

irm

address

IRM contract (must be enabled)

liquidationModule

address

Liquidation module contract (must be enabled, non-zero)

collateralTokens

address[]

One collateral token per tranche

oracles

address[]

One oracle per tranche

lltvs

uint128[]

One LLTV per tranche (all must be enabled)

Array lengths define the number of tranches. All three arrays must be the same length and non-empty.

  • Validation:

    1. IRM must be enabled via enableIrm

    2. Market must not already exist (same MarketParams hash)

    3. Liquidation module must not be the zero address

    4. Liquidation module must be enabled via enableLiquidationModule

    5. All arrays must be non-empty and the same length

    6. Every LLTV value must be enabled via enableLltv

  • Reverts:

    • IrmNotEnabled(irm) — IRM not in enablelist

    • MarketAlreadyExists(id) — market with identical parameters exists

    • ZeroAddress — liquidation module is address(0)

    • LiquidationModuleNotEnabled(liquidationModule) — module not in enablelist

    • InconsistentInput — arrays are empty or different lengths

    • LltvNotEnabled(lltv) — an LLTV value is not in the enablelist

  • Events: MarketCreated(Id indexed id, MarketParams marketParams)

  • Side effects: Calls IIrm(irm).initialize(id, irmParams) and ILiquidationModule(liquidationModule).initializeMarket(id, liquidationParams)

Market Hooks

setMarketHook(MarketParams memory marketParams, address hook, uint256 permissions)

Configures a hook for an existing market. Hooks execute custom logic after core operations and can approve or reject transactions by returning their selector or reverting.

Parameter
Type
Description
Required

marketParams

MarketParams

Market configuration identifying the target market

Yes

hook

address

Hook contract address, or address(0) to remove the hook

Yes

permissions

uint256

Bitmask of hook permission flags

Yes

Permission flags (from Hooks.sol):

Flag
Value
Triggers After

AFTER_SUPPLY_FLAG

1 << 0 (1)

supply()

AFTER_BORROW_FLAG

1 << 1 (2)

borrow()

AFTER_SUPPLY_COLLATERAL_FLAG

1 << 2 (4)

supplyCollateral()

AFTER_WITHDRAW_FLAG

1 << 3 (8)

withdraw()

AFTER_WITHDRAW_COLLATERAL_FLAG

1 << 4 (16)

withdrawCollateral()

Combine flags with bitwise OR. For example, to hook supply and borrow: permissions = 1 | 2 (= 3).

  • Validation: If hook is not address(0), it must be a deployed contract (have code). Setting hook to address(0) disables all hooks for the market regardless of the permissions value.

  • Reverts:

    • NotOwner — caller is not the current owner

    • MarketNotCreated(id) — market does not exist

    • InvalidHook(hook)hook is non-zero but has no deployed code

  • Events: MarketHookSet(Id indexed id, address indexed hook, uint256 permissions)

Admin View Functions

isIrmEnabled(address irm)

Returns true if the IRM address is in the enablelist.

  • Parameters: irm (address)

  • Returns: bool

isLltvEnabled(uint256 lltv)

Returns true if the LLTV value is in the enablelist.

  • Parameters: lltv (uint256)

  • Returns: bool

isLiquidationModuleEnabled(address liquidationModule)

Returns true if the liquidation module address is in the enablelist.

  • Parameters: liquidationModule (address)

  • Returns: bool

getMarketHookConfig(Id id)

Returns the hook configuration for a market.

Parameter
Type
Description
Required

id

Id

Yes

  • Returns:

    • hook (address) — hook contract address, or address(0) if no hook is set

    • permissions (uint256) — permissions bitmask

See Also

Last updated