Skip to content

Admin Operations

Pool Management (Time-Locked)

Pool creation and configuration updates are unified under a single time-locked flow. Both use the same queue → wait → apply pattern, subject to the market's update_in_queue_period.

queue_in_pool_set

Queue a new pool creation or an existing pool's configuration update. If the pool address already exists, this queues a config update; otherwise it queues a new pool creation.

rust
fn queue_in_pool_set(
    pool_address: Address,
    pool_config: PoolConfig,
) -> Result<(), MCError>
ParameterTypeDescription
pool_addressAddressAddress of the token/pool being created or updated
pool_configPoolConfigFull pool configuration to apply

INFO

For new pools, the admin does not need to be on an "owned" market. For updates to existing pools, the market must be "owned".


apply_pool_set

Apply a queued pool set after the time-lock period has elapsed. Creates the new pool or updates the existing pool's configuration.

rust
fn apply_pool_set(pool_address: Address) -> Result<(), MCError>

cancel_pool_set

Cancel a pending pool set before it is applied.

rust
fn cancel_pool_set(pool_address: Address) -> Result<(), MCError>

get_queued_pool_set

Get the pending pool set for a given pool address, if one exists.

rust
fn get_queued_pool_set(pool_address: Address) -> Result<QueuedPoolSet, MCError>

Market Configuration (Time-Locked)

Market-level parameter updates also follow the queue → wait → apply pattern.

queue_in_market_update

Queue a market configuration update. Only one update can be queued at a time.

rust
fn queue_in_market_update(
    new_max_positions: u32,
    new_min_collateral_value_cents: i128,
) -> Result<(), MCError>
ParameterTypeDescription
new_max_positionsu32Updated maximum number of positions per obligation (2–25)
new_min_collateral_value_centsi128Updated minimum collateral value in cents

apply_market_update

Apply the queued market configuration update after the time-lock period.

rust
fn apply_market_update() -> Result<(), MCError>

cancel_market_update

Cancel a pending market configuration update.

rust
fn cancel_market_update() -> Result<(), MCError>

get_market_queued_in_update

Get the pending market update, if one exists.

rust
fn get_market_queued_in_update() -> Result<MarketUpdate, MCError>

Market Status

update_market_status

Change the market's operational status. Admin-only on owned markets.

rust
fn update_market_status(new_status: u32) -> Result<(), MCError>
StatusValueDescription
Active0All operations enabled
BorrowFrozen1Borrowing disabled
BorrowFrozenByAdmin2Borrowing disabled; Insurance Fund cannot override
DepositFrozen3Deposits and borrowing disabled
DepositFrozenByAdmin4Deposits and borrowing disabled; Insurance Fund cannot override
Frozen5All operations disabled (only liquidations and withdrawals proceed)
FrozenByAdmin6Fully frozen; Insurance Fund cannot override

The *ByAdmin variants are "hard locks" that only the market admin can change. The Insurance Fund contract cannot transition into or out of these states.


fund_update_market_status

Allow the Insurance Fund contract to update the market status. This enables the fund to freeze the market in emergency situations.

rust
fn fund_update_market_status(new_status: u32) -> Result<(), MCError>

WARNING

The Insurance Fund cannot set or clear *ByAdmin statuses. If the current status is admin-protected, this call will fail.


Pool Status

update_pool_status

Update per-pool operation flags. Admin-only on owned markets.

rust
fn update_pool_status(
    pool_address: Address,
    new_status_flags: u32,
) -> Result<(), MCError>

Pool status is a 4-bit bitfield where each bit enables a specific operation:

BitFlagOperation
01Deposit enabled
12Borrow enabled
24Add collateral enabled
38Flash loan enabled

Setting flags = 0 disables all operations on the pool. Setting flags = u32::MAX (or 15) enables all operations.


Fee Beneficiaries

set_take_rate_fees_beneficiaries

Set the beneficiaries list for take-rate fees on a pool. Shares (in basis points) must add up to 100% (10,000 bps).

rust
fn set_take_rate_fees_beneficiaries(
    pool_address: Address,
    beneficiaries: Map<Address, u32>,
) -> Result<(), MCError>

INFO

Calling this function automatically distributes any accumulated pool fees before updating the beneficiaries, ensuring accurate fee accounting.


set_operation_fees_beneficiaries

Set the beneficiaries list for origination (operation) fees on a pool. Shares must add up to 100%.

rust
fn set_operation_fees_beneficiaries(
    pool_address: Address,
    beneficiaries: Map<Address, u32>,
) -> Result<(), MCError>

Swap Provider

update_swap_provider

Update the swap provider contract address used for batch swap operations.

rust
fn update_swap_provider(new_swap_provider: Address)

Admin Transfer

Admin transfer is a two-step process to prevent accidental transfers.

propose_new_admin

Propose a new admin. The current admin must authorize this call.

rust
fn propose_new_admin(new_admin: Address) -> Result<(), MCError>

accept_proposed_admin

Accept the admin role. The proposed admin must authorize this call.

rust
fn accept_proposed_admin() -> Result<(), MCError>

Contract Upgrade

upgrade

Upgrade the market contract to a new WASM binary. Requires deployer authorization (not admin). There is no time-lock on upgrades — the deployer can upgrade immediately.

rust
fn upgrade(new_wasm_hash: BytesN<32>)