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.
fn queue_in_pool_set(
pool_address: Address,
pool_config: PoolConfig,
) -> Result<(), MCError>// 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>>>| Parameter | Type | Description |
|---|---|---|
pool_address | Address | Address of the token/pool being created or updated |
pool_config | PoolConfig | Full 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.
fn apply_pool_set(pool_address: Address) -> Result<(), MCError>// 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.
fn cancel_pool_set(pool_address: Address) -> Result<(), MCError>// 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.
fn get_queued_pool_set(pool_address: Address) -> Result<QueuedPoolSet, MCError>// 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.
fn queue_in_market_update(
new_max_positions: u32,
new_min_collateral_value_cents: i128,
new_bad_debt_lock_d: u64,
) -> Result<(), MCError>// 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>>>| Parameter | Type | Description |
|---|---|---|
new_max_positions | u32 | Updated maximum number of positions per obligation (2–25) |
new_min_collateral_value_cents | i128 | Updated minimum collateral value in cents |
new_bad_debt_lock_d | u64 | Updated bad debt lock duration in seconds |
apply_market_update
Apply the queued market configuration update after the time-lock period.
fn apply_market_update() -> Result<(), MCError>// 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.
fn cancel_market_update() -> Result<(), MCError>// 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.
fn get_market_queued_in_update() -> Result<MarketUpdate, MCError>// 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.
fn update_market_status(new_status: u32) -> Result<(), MCError>update_market_status: (
{new_status}: {new_status: u32},
options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>| Status | Value | Description |
|---|---|---|
| Active | 0 | All operations enabled |
| BorrowFrozen | 1 | Borrowing disabled |
| BorrowFrozenByAdmin | 2 | Borrowing disabled; Insurance Fund cannot override |
| DepositFrozen | 3 | Deposits and borrowing disabled |
| DepositFrozenByAdmin | 4 | Deposits and borrowing disabled; Insurance Fund cannot override |
| Frozen | 5 | All operations disabled (only liquidations and withdrawals proceed) |
| FrozenByAdmin | 6 | Fully 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.
fn fund_update_market_status(new_status: u32) -> Result<(), MCError>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.
fn update_pool_status(
pool_address: Address,
new_status_flags: u32,
) -> Result<(), MCError>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:
| Bit | Flag | Operation |
|---|---|---|
| 0 | 1 | Deposit enabled |
| 1 | 2 | Borrow enabled |
| 2 | 4 | Add collateral enabled |
| 3 | 8 | Flash 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).
fn set_take_rate_fees_beneficiaries(
pool_address: Address,
beneficiaries: Map<Address, u32>,
) -> Result<(), MCError>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%.
fn set_operation_fees_beneficiaries(
pool_address: Address,
beneficiaries: Map<Address, u32>,
) -> Result<(), MCError>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.
fn propose_new_admin(new_admin: Address) -> Result<(), MCError>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.
fn accept_proposed_admin() -> Result<(), MCError>accept_proposed_admin: (
options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>