Bonzo Finance Documentation
  • 🤠Overview
  • 🗺️Roadmap
  • GET STARTED
    • 🏦Bonzo Mainnet
      • Connect Wallet
      • Supply Assets
      • Withdraw Assets
      • Enable / Disable Collateral
      • Borrow Assets
      • Repay Loan
      • Dashboard Metrics Explained
    • ❗Troubleshooting
    • 🧪Bonzo Testnet
    • 💸Protocol Fees & Revenue
    • 💧Liquidations
    • 🌐Hedera ($HBAR)
      • Hedera Wallet Setup
      • Obtaining $HBAR
      • Bridging Assets
  • Rewards & Incentives
    • 🥩Single-Sided Staking
    • ✨Native APYs & Liquidity Incentives
    • 🎟️Bonzo Points
      • Pre-Season Points Airdrop
      • Season One Points
      • Season Two Points
    • 🖼️Bonzo NFT Collectables
      • 1st Edition Bonzo NFTs
      • Cybernetic NFT
      • Commemorative NFT
      • Ownership & License Terms
  • SECURITY & RISK
    • ⚠️Risk Framework
    • 🛡️Audits
  • CONTRIBUTORS
    • 🐵Team
    • 👷Careers
    • 🎉Community
  • DEVELOPER
    • 📊Bonzo v1 Data API
    • 📜Protocol Contracts
    • 🤖Liquidation Bots (Beta)
      • 🛸SaucerSwap DEX
      • Environment Setup
      • Liquidator Contract
      • Configuring Hardhat
      • Performing a Liquidation
    • ⚡Flash Loans
    • 🔮Oracles
      • Supra
      • Chainlink
    • 👾GitHub
    • 🐞Bug Bounty
  • RESOURCES
    • 🟢Status Page
    • 🎨Brand Assets
    • 📚Glossary
    • 📞Contact
      • Support
      • Community
  • TRANSPARENCY
  • 🏦Accounts & Contracts
  • LEGAL
    • 📃Terms of Service
    • 🔒Privacy Policy
Powered by GitBook
On this page
  • 1. Identify Liquidatable Accounts
  • 2. Configure the Liquidation Parameters
  • 3. Execute the Script
  • 4. Monitor the Output
  1. DEVELOPER
  2. Liquidation Bots (Beta)

Performing a Liquidation

PreviousConfiguring HardhatNextFlash Loans

Last updated 5 months ago

Now, we'll execute the script to perform the liquidation.

1. Identify Liquidatable Accounts

The script contains a list of accounts that are eligible for liquidation. You can get these accounts through this API on the testnet:

The "Liquidatable Accounts API" for the Hedera mainnet will be made available soon.

2. Configure the Liquidation Parameters

In the script, the liquidate function is set up to liquidate a specific user. Update the parameters accordingly.

async function liquidate() {
  const user = liquidatables[2]; // Index of the user in the list
  const collateralReserve = "0xCollateralAssetAddress"; // Collateral asset address
  const debtReserve = "0xDebtAssetAddress"; // Debt asset address
  const borrowed = ethers.utils.parseUnits("100", 18); // Amount to cover

  // ... rest of the code
}
  • user: The address of the user to liquidate.

  • collateralReserve: The address of the collateral asset.

  • debtReserve: The address of the debt asset.

  • borrowed: The amount of debt to cover (in wei).

Replace the placeholders with the actual values based on the user's positions.

3. Execute the Script

Run the script using Hardhat:

npx hardhat run scripts/liquidationFlashLoan/liquidate.ts --network hedera_testnet

4. Monitor the Output

The script will output the progress of the liquidation:

User: 0x78c3edaf3ae5dc69e688d7f41f85c4745ccd552c
Caller address: 0xYourWalletAddress
Collateral Reserve: 0xCollateralAssetAddress
Debt Reserve: 0xDebtAssetAddress
Borrowed: 100

Flash loan successful

If the liquidation is successful, you'll see a confirmation message. If there are errors, the script will output the error details.

🤖
Liquidatable Accounts API