### Querying Liquidation Entity in GraphQL Source: https://github.com/secured-finance/secured-finance-docs/blob/main/developer-portal/api-reference/fixed-rate-lending-subgraph/query-examples.md This query retrieves information about liquidations associated with a specific user. It includes the user's ID, collateral currency, debt currency, debt maturity, and the amount of debt involved in the liquidation. ```GraphQL { liquidations(where: {user: "0xe477f1adcd3b4a2e1e152f79105a18e5368f0d33"}) { user { id } collateralCurrency debtCurrency debtMaturity debtAmount } } ``` -------------------------------- ### Querying Transaction Entity in GraphQL Source: https://github.com/secured-finance/secured-finance-docs/blob/main/developer-portal/api-reference/fixed-rate-lending-subgraph/query-examples.md This query fetches details about transactions where a user either takes an order or their order is taken. It includes the taker's ID, currency, maturity, side of the transaction, and the amount involved. ```GraphQL { transactions(where: {taker: "0xe477f1adcd3b4a2e1e152f79105a18e5368f0d33"}) { taker { id } currency maturity side amount } } ``` -------------------------------- ### Querying Transfer Entity in GraphQL Source: https://github.com/secured-finance/secured-finance-docs/blob/main/developer-portal/api-reference/fixed-rate-lending-subgraph/query-examples.md This query fetches details about asset transfers (deposits or withdrawals) made by a specific user. It includes the user's ID, currency, amount, and the type of transfer (deposit or withdrawal). ```GraphQL { transfers(where: {user: "0xe477f1adcd3b4a2e1e152f79105a18e5368f0d33"}) { user { id } currency amount transferType } } ``` -------------------------------- ### Querying Order Entity in GraphQL Source: https://github.com/secured-finance/secured-finance-docs/blob/main/developer-portal/api-reference/fixed-rate-lending-subgraph/query-examples.md This query retrieves information about an order placed by a specific maker. It fetches details such as order ID, maker ID, side, currency, maturity, status, filled amount, input amount, and input unit price for orders associated with the given maker address. ```GraphQL { orders(where: {maker: "0xe477f1adcd3b4a2e1e152f79105a18e5368f0d33"}) { orderId maker { id } side currency maturity status filledAmount inputAmount inputUnitPrice } } ``` -------------------------------- ### Querying User Entity with Nested Data in GraphQL Source: https://github.com/secured-finance/secured-finance-docs/blob/main/developer-portal/api-reference/fixed-rate-lending-subgraph/query-examples.md This comprehensive query retrieves all information for a specific user, including their associated orders, transactions, liquidations, and transfers. It demonstrates how to apply sorting, pagination (skip/first), and filtering on nested entities to retrieve specific related data. ```GraphQL { user (id: "0xe477f1adcd3b4a2e1e152f79105a18e5368f0d33") { id orders (orderBy: orderId, orderDirection: asc) { orderId currency maturity status } transactions (skip: 20, first: 20) { currency maturity amount } liquidations (where: {debtCurrency: "0x4554480000000000000000000000000000000000000000000000000000000000"}, orderBy: debtAmount, orderDirection: desc) { debtCurrency debtMaturity debtAmount } transfers (where: {transferType: Deposit}) { currency amount } } } ``` -------------------------------- ### Querying Users with Nested Order Filtering in GraphQL Source: https://github.com/secured-finance/secured-finance-docs/blob/main/developer-portal/api-reference/fixed-rate-lending-subgraph/query-examples.md This query demonstrates how to apply nested filtering to retrieve users based on properties of their associated orders. Specifically, it fetches users who have an order with a `orderId` of 1, and then retrieves the details of those specific orders. ```GraphQL { users (where: { orders_ : {orderId: 1}}) { id orders (where: {orderId: 1}) { orderId currency maturity status inputAmount inputUnitPrice } } } ``` -------------------------------- ### Liquidation Process Flow Diagram (Mermaid) Source: https://github.com/secured-finance/secured-finance-docs/blob/main/fixed-rate-lending/core-mechanics/liquidation/collateral-liquidations/how-liquidation-works.md This Mermaid sequence diagram illustrates the step-by-step liquidation process within the Secured-Finance protocol. It shows the interaction between the Liquidator Bot, the Liquidator smart contract, the LendingMarketController, FutureValueVault, and TokenVault, detailing the checks, transfers, and callback executions involved in a liquidation. ```Mermaid sequenceDiagram autonumber title Liquidation Process actor Bot as Liquidatior participant Liquidator as Liquidator participant Market as LendingMarketContoroller participant FV as FutureValueVault participant Token as TokenVault Bot-->>Market: Check if the selected user
has enough collateral Bot-->>Liquidator: Liquidate the
selected user Liquidator-->>Market: Execute liquidation
process Market-->>Market: Check if the selected user
doesn't has enough collateral Market-->>Token: Transfer the collaterl balance
from the selected user
to the liquidator
(Liquidation fee included) Market-->>Liquidator: Execute the callback
function for the collateral Market-->>FV: Transfer the debt balance
from the selected user
to the liquidator Market-->>Liquidator: Execute the callback
function for debt Market-->>Market: Check if the liquidator
has enough collateral ``` -------------------------------- ### Illustrating Liquidation Process Flow with Mermaid Source: https://github.com/secured-finance/secured-finance-docs/blob/main/fixed-rate-lending/core-mechanics/liquidation/liquidators/how-liquidation-works.md This Mermaid sequence diagram visualizes the end-to-end liquidation process within the secured finance protocol. It outlines the interactions between the Liquidator Bot, Liquidator contract, LendingMarketController, FutureValueVault, and TokenVault, demonstrating the flow of checks, transfers, and callback executions during a liquidation event. ```mermaid sequenceDiagram autonumber title Liquidation Process actor Bot as Liquidatior participant Liquidator as Liquidator participant Market as LendingMarketContoroller participant FV as FutureValueVault participant Token as TokenVault Bot-->>Market: Check if the selected user
has enough collateral Bot-->>Liquidator: Liquidate the
selected user Liquidator-->>Market: Execute liquidation
process Market-->>Market: Check if the selected user
doesn't has enough collateral Market-->>Token: Transfer the collaterl balance
from the selected user
to the liquidator
(Liquidation fee included) Market-->>Liquidator: Execute the callback
function for the collateral Market-->>FV: Transfer the debt balance
from the selected user
to the liquidator Market-->>Liquidator: Execute the callback
function for debt Market-->>Market: Check if the liquidator
has enough collateral ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.