PegKeeper
The Pegkeeper contract is a critical component of the Orbit Protocol that maintains stablecoin pegs through automated market operations. It executes liquidations and performs AMM trades using flash-loaned tokens to ensure stablecoin stability.
Core Components
Initialization
The Pegkeeper initializes with two essential parameters:
admin
: The address with administrative privilegesrouter
: The AMM router address for executing trades
Flash Loan Handler
The fl_receive
function is the core operation handler that:
Receives flash-loaned stablecoins
Executes liquidations
Performs AMM trades
Manages profits
Handles loan repayment
Error Management
AlreadyInitializedError
: Prevents duplicate initializationNotProfitable
: Reverts unprofitable operations
Events
The contract emits events for major operations:
Contract initialization
Flash loan reception
Successful operations
Last updated