BController
BController manages Mercury protocol and pool configuration, creator metadata, and creator/protocol fee claims.
Overview
BController is Mercury's pool configuration and fee-distribution component, containing creator-specific functions and protocol admin controls. Below are creator-specific public functions.
Creator Functions
claimPoolFees
Claims accrued creator and protocol fees for a pool. Anyone can call this function. The contract first sweeps pending pool accounting, then sends creator fees to the pool's feeRecipient and protocol fees to the protocol fee recipient.
function claimPoolFees(BToken _bToken) external| Parameter | Type | Description |
|---|---|---|
_bToken | BToken | Pool whose creator and protocol fees should be claimed |
claimPoolFeesMulti
Claims accrued fees for multiple pools in one transaction.
function claimPoolFeesMulti(BToken[] calldata _bTokens) external| Parameter | Type | Description |
|---|---|---|
_bTokens | BToken[] | Pools to process in order |
setFeeRecipient
Updates the address that receives the creator share of claimed fees for a pool. Callable by the pool creator, Relay, or an executor while the pool is not paused.
function setFeeRecipient(BToken _bToken, address _feeRecipient) external| Parameter | Type | Description |
|---|---|---|
_bToken | BToken | Pool to update |
_feeRecipient | address | New creator-fee recipient |
transferCreator
Transfers the recorded creator role for a pool. Callable by the current pool creator, Relay, or an executor while the pool is not paused.
function transferCreator(BToken _bToken, address _newCreator) external| Parameter | Type | Description |
|---|---|---|
_bToken | BToken | Pool to update |
_newCreator | address | New creator address |
modifyCreatorFeePct
Updates the creator fee split for a pool. This is a protocol-admin operation and must be less than or equal to 1e18 (100% in WAD precision).
function modifyCreatorFeePct(BToken _bToken, uint256 _creatorFeePct) external| Parameter | Type | Description |
|---|---|---|
_bToken | BToken | Pool to update |
_creatorFeePct | uint256 | WAD percentage of post-protocol fees paid to the creator fee recipient |
pausePool
Pauses a single pool. Callable by an executor, Relay, or by the pool creator when that creator has an active deployer profile with pauser enabled.
function pausePool(BToken _bToken) externalunpausePool
Unpauses a single pool with the same authorization rules as pausePool.
function unpausePool(BToken _bToken) externalEvents
event FeesClaimed(address bToken, address reserve, uint256 creatorAmount, uint256 protocolAmount);
event CreatorTransferred(address bToken, address newCreator);
event FeeRecipientSet(address bToken, address feeRecipient);
event CreatorFeePctSet(address bToken, uint256 creatorFeePct);
event LiquidityFeePctSet(address bToken, uint256 liquidityFeePct);ABI
[
{
"type": "function",
"name": "LABEL",
"inputs": [],
"outputs": [
{
"name": "",
"type": "bytes32",
"internalType": "bytes32"
}
],
"stateMutability": "pure"
},
{
"type": "function",
"name": "ROUTES",
"inputs": [],
"outputs": [
{
"name": "routes_",
"type": "bytes4[]",
"internalType": "bytes4[]"
}
],
"stateMutability": "pure"
},
{
"type": "function",
"name": "VERSION",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "pure"
},
{
"type": "function",
"name": "claimPoolFees",
"inputs": [
{
"name": "_bToken",
"type": "address",
"internalType": "contract BToken"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "claimPoolFeesMulti",
"inputs": [
{
"name": "_bTokens",
"type": "address[]",
"internalType": "contract BToken[]"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "modifyCreatorFeePct",
"inputs": [
{
"name": "_bToken",
"type": "address",
"internalType": "contract BToken"
},
{
"name": "_creatorFeePct",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "modifyLiquidityFeePct",
"inputs": [
{
"name": "_bToken",
"type": "address",
"internalType": "contract BToken"
},
{
"name": "_liquidityFeePct",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "pausePool",
"inputs": [
{
"name": "_bToken",
"type": "address",
"internalType": "contract BToken"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "pauseProtocol",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "setBTokenDeployment",
"inputs": [
{
"name": "_bToken",
"type": "address",
"internalType": "contract BToken"
},
{
"name": "_deployer",
"type": "address",
"internalType": "address"
},
{
"name": "_totalSupply",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "setDeployerProfile",
"inputs": [
{
"name": "_deployer",
"type": "address",
"internalType": "address"
},
{
"name": "_active",
"type": "bool",
"internalType": "bool"
},
{
"name": "_approvedCreditDeployer",
"type": "bool",
"internalType": "bool"
},
{
"name": "_pauser",
"type": "bool",
"internalType": "bool"
},
{
"name": "_protocolFeePct",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "_liquidityFeePct",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "setFeeRecipient",
"inputs": [
{
"name": "_bToken",
"type": "address",
"internalType": "contract BToken"
},
{
"name": "_feeRecipient",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "setReserveApproval",
"inputs": [
{
"name": "_reserve",
"type": "address",
"internalType": "address"
},
{
"name": "_approved",
"type": "bool",
"internalType": "bool"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "supportsInterface",
"inputs": [
{
"name": "_interfaceId",
"type": "bytes4",
"internalType": "bytes4"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "pure"
},
{
"type": "function",
"name": "transferCreator",
"inputs": [
{
"name": "_bToken",
"type": "address",
"internalType": "contract BToken"
},
{
"name": "_newCreator",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "unpausePool",
"inputs": [
{
"name": "_bToken",
"type": "address",
"internalType": "contract BToken"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "unpauseProtocol",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "event",
"name": "ApprovedCreditDeployerSet",
"inputs": [
{
"name": "user",
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "approved",
"type": "bool",
"indexed": false,
"internalType": "bool"
}
],
"anonymous": false
},
{
"type": "event",
"name": "CreatorFeePctSet",
"inputs": [
{
"name": "bToken",
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "creatorFeePct",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "CreatorTransferred",
"inputs": [
{
"name": "bToken",
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "newCreator",
"type": "address",
"indexed": false,
"internalType": "address"
}
],
"anonymous": false
},
{
"type": "event",
"name": "DeployerProfileSet",
"inputs": [
{
"name": "deployer",
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "profile",
"type": "tuple",
"indexed": false,
"internalType": "struct State.DeployerProfile",
"components": [
{
"name": "active",
"type": "bool",
"internalType": "bool"
},
{
"name": "approvedCreditDeployer",
"type": "bool",
"internalType": "bool"
},
{
"name": "pauser",
"type": "bool",
"internalType": "bool"
},
{
"name": "protocolFeePct",
"type": "uint64",
"internalType": "uint64"
},
{
"name": "liquidityFeePct",
"type": "uint64",
"internalType": "uint64"
}
]
}
],
"anonymous": false
},
{
"type": "event",
"name": "DeployerSet",
"inputs": [
{
"name": "bToken",
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "deployer",
"type": "address",
"indexed": false,
"internalType": "address"
}
],
"anonymous": false
},
{
"type": "event",
"name": "FeeRecipientSet",
"inputs": [
{
"name": "bToken",
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "feeRecipient",
"type": "address",
"indexed": false,
"internalType": "address"
}
],
"anonymous": false
},
{
"type": "event",
"name": "FeesClaimed",
"inputs": [
{
"name": "bToken",
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "reserve",
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "creatorAmount",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "protocolAmount",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "LiquidityFeePctSet",
"inputs": [
{
"name": "bToken",
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "liquidityFeePct",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "ReserveApproved",
"inputs": [
{
"name": "reserve",
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "approved",
"type": "bool",
"indexed": false,
"internalType": "bool"
}
],
"anonymous": false
},
{
"type": "error",
"name": "BController_InvalidCreatorFee",
"inputs": []
},
{
"type": "error",
"name": "BController_InvalidDecimals",
"inputs": []
},
{
"type": "error",
"name": "BController_InvalidLiquidityFee",
"inputs": []
},
{
"type": "error",
"name": "BController_NotCreatorOrExecutor",
"inputs": []
},
{
"type": "error",
"name": "BController_NotPauserOrExecutor",
"inputs": []
},
{
"type": "error",
"name": "Component_NotPermitted",
"inputs": []
},
{
"type": "error",
"name": "GuardLib_InsufficientSettledReserves",
"inputs": []
},
{
"type": "error",
"name": "GuardLib_Paused",
"inputs": []
},
{
"type": "error",
"name": "GuardLib_Reentrant",
"inputs": []
},
{
"type": "error",
"name": "GuardLib_ReserveAccountingMismatch",
"inputs": []
}
]Related
- Contracts Overview: Mercury deployment addresses