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>
typescript
// Named queue_in_pool_config_update in the TypeScript SDK:
queue_in_pool_config_update: (
  {pool_address, new_pool_config}:
    {pool_address: string, new_pool_config: PoolConfig},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>
ParameterTypeDescription
pool_addressAddressAddress of the token/pool being created or updated
pool_configPoolConfigFull pool configuration to apply

INFO

For new pools, the market does not need to be "owned" - admin can always queue in new pool initialization. For updates to existing pools, the market must be strictly "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>
typescript
// Named apply_pool_config_update in the TypeScript SDK:
apply_pool_config_update: (
  {pool_address}: {pool_address: string},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>

cancel_pool_set

Cancel a pending pool set before it is applied.

rust
fn cancel_pool_set(pool_address: Address) -> Result<(), MCError>
typescript
// Named cancel_pool_config_update in the TypeScript SDK:
cancel_pool_config_update: (
  {pool_address}: {pool_address: string},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>

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>
typescript
// Named get_pool_config_queued_in_update in the TypeScript SDK.
// Returns PoolUpdate instead of QueuedPoolSet:
get_pool_config_queued_in_update: (
  {pool_address}: {pool_address: string},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<PoolUpdate>>>

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,
    new_bad_debt_lock_d: u64,
) -> Result<(), MCError>
typescript
// Named update_market in the TypeScript SDK:
update_market: (
  {new_max_positions, new_min_collateral_value_cents, new_bad_debt_lock_d}:
    {new_max_positions: u32, new_min_collateral_value_cents: i128, new_bad_debt_lock_d: u64},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>
ParameterTypeDescription
new_max_positionsu32Updated maximum number of positions per obligation (2–25)
new_min_collateral_value_centsi128Updated minimum collateral value in cents
new_bad_debt_lock_du64Updated bad debt lock duration in seconds

apply_market_update

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

rust
fn apply_market_update() -> Result<(), MCError>
typescript
// This function is not directly exposed in the TypeScript SDK.
// The update_market method handles queuing; apply/cancel
// operations require direct contract invocation.

cancel_market_update

Cancel a pending market configuration update.

rust
fn cancel_market_update() -> Result<(), MCError>
typescript
// This function is not directly exposed in the TypeScript SDK.
// Apply/cancel market update operations require direct
// contract invocation.

get_market_queued_in_update

Get the pending market update, if one exists.

rust
fn get_market_queued_in_update() -> Result<MarketUpdate, MCError>
typescript
// This function is not directly exposed in the TypeScript SDK.
// Query the contract storage directly to read the pending
// market update.

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>
typescript
update_market_status: (
  {new_status}: {new_status: u32},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>
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>
typescript
fund_update_market_status: (
  {new_status}: {new_status: u32},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>

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>
typescript
update_pool_status: (
  {pool_address, new_status_flags}:
    {pool_address: string, new_status_flags: u32},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>

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>
typescript
set_take_rate_fees_beneficiaries: (
  {pool_address, beneficiaries}:
    {pool_address: string, beneficiaries: Map<string, u32>},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>

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>
typescript
set_operation_fees_beneficiaries: (
  {pool_address, beneficiaries}:
    {pool_address: string, beneficiaries: Map<string, u32>},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>

INFO

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


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>
typescript
propose_new_admin: (
  {new_admin}: {new_admin: string},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>

accept_proposed_admin

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

rust
fn accept_proposed_admin() -> Result<(), MCError>
typescript
accept_proposed_admin: (
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>