LIQUIDATOR_ROLE on the markets connected to it, so any caller can trigger a liquidation through it and no wallet has to hold the role itself. The wallet that deploys a bot owns it and signs every change to it. Trusset holds no key to a bot and never calls one.
The SDK builds no call to the bot’s own liquidate, because the API builds none. A keeper you run, or any third party, encodes that call from the bot contract’s ABI. The bot forwards it to the market, which checks the role, the price and the loan, and reverts otherwise.
Every write on this page follows the signing model: without options it returns the unsigned transaction, with { signer } it signs and confirms, and with { txHash } it confirms one you broadcast. Any ethers v5 Signer works, self-custody or regulated custodian, with no preference.
Deploy a bot
The owner is the wallet that signs the deployment. With{ signer }, the SDK fills signerAddress from the signer and refuses a different one, so the bot is owned by the wallet you pass.
bot, the confirmed txHash, and transactions. The API takes the bot’s address and owner from the factory’s ShimDeployed event, never from the request. A label is at most 64 characters.
Only the owner can enable markets on the bot, pause it, set its refund policy and withdraw its float. The bot is not upgradeable. Replacing one means deploying another and moving the market roles to it.
Connect a bot to a market
A connection has two halves held by two parties. The bot side issetMarketEnabled on the bot, signed by the bot’s owner. The market side grants the bot LIQUIDATOR_ROLE on the market, signed by the market admin. The API reads both halves and returns only the steps not already in the requested state, the bot step first.
When one wallet is both the bot’s owner and the market admin, pass it as the signer:
authority. A BOT_OWNER step needs the bot’s ownerWallet. A MARKET_ADMIN step needs a wallet holding MARKET_ADMIN on the market, which the SDK reads from the API. A wrong wallet throws a ValidationError, and a role that cannot be read throws ROLE_UNREADABLE with status 503. In both cases nothing was signed.
When the two halves belong to two wallets, prepare without a signer and have each wallet sign the step its authority names:
bots.get shows the change at once.
A market still looking for its lender of record has no market admin, so its market step cannot succeed. The lender of record can grant the role instead while accepting the market, by naming the bot as liquidator. See Operators.
disconnect takes the same arguments and returns the reverse steps: setMarketEnabled(market, false) and revokeRole.
MARKET_ADMIN step the owner cannot sign. Prepare without a signer then, and have the owner sign the bot step.
Fund the refunds
After a successful liquidation, the bot refunds the caller’s gas from its float of the network’s native coin. A reverted liquidation pays nothing. Any wallet can fund a bot.value and no calldata. The SDK sends value exactly as the API returned it.
Set the refund policy
"0" disables refunds, and callers then pay their own gas.
Pause and resume a bot
A paused bot refuses every trigger on every market. The markets enabled on it stay enabled, soresume puts it back to work on the same markets.
Withdraw the float
to defaults to the bot’s recorded owner. A bot whose balance is zero is refused with NOTHING_TO_WITHDRAW, because the contract would revert.
Label or archive a bot
label of null clears it. A request that changes nothing, such as archived at its current value, is refused with VALIDATION_ERROR.
Read bots
list returns the instance’s bots, newest first, each with its state read from the chain. It also returns the instance’s deployed markets, which are the markets a bot can be connected to. Archived bots are left out unless you pass includeArchived: true.
onChain carries the owner, the paused switch, the refund policy, the float in balance, and one entry per market in connections. A market counts as connected only when both halves hold. A read that failed is marked readFailed: true and is never reported as a disconnected market. Chain reads are cached for up to 15 seconds.
transactions returns the bot’s activity read from its own contract events, newest first, with the deployment as the last entry:
limit runs from 1 to 200 and defaults to 50. There is no offset, so the newest 200 events are the furthest back it reaches. An event appears once its block is six blocks deep.
