Strike Docs
  • 📖Strike Documentation
  • ⭐Getting Started
    • 🧑‍🏫Guides
    • 🔬Networks
    • 📒Protocol Math
      • sToken and Underlying Decimals
      • Interpreting Exchange Rates
      • Calculating Accrued Interest
      • Calculating the APY Using Rate Per Block
    • 💹Gas Costs
  • 🎙️STokens
    • Mint
    • Redeem
    • Redeem Underlying
    • Borrow
    • Repay Borrow
    • Repay Borrow Behalf
    • Transfer
    • Liquidate Borrow
    • Key Events
    • Error Codes
    • Failure Info
    • Exchange Rate
    • Get Cash
    • Total Borrow
    • Borrow Balance
    • Borrow Rate
    • Total Supply
    • Underlying Balance
    • Supply Rate
    • Total Reserves
    • Reserve Factor
  • ⚙️Comptroller
    • Enter Markets
    • Exit Market
    • Get Assets In
    • Collateral Factor
    • Get Account Liquidity
    • Close Factor
    • Liquidation Incentive
    • Key Events
    • Error Codes
    • Failure Info
    • STRK Distribution Speeds
    • Claim STRK
    • Market Metadata
  • 👨‍👩‍👦Governance
    • Delegate
    • Delegate By Signature
    • Get Current Votes
    • Get Prior Votes
    • Key Events
    • Governor Alpha
    • Quorum Votes
    • Proposal Threshold
    • Proposal Max Operations
    • Voting Delay
    • Voting Period
    • Propose
    • Queue
    • Execute
    • Cancel
    • Get Actions
    • Get Receipt
    • State
    • Cast Vote
    • Cast Vote By Signature
    • Timelock
    • Pause Guardian
  • 🔡API
    • STokenService
      • GET: /stoken
    • MarketHistoryService
      • GET: /market_history/graph
    • ProposalService
      • GET: /proposals
      • GET: /proposals/:id
      • GET: /proposals/statistics
    • VoterService
      • GET: /voters/accounts
      • GET: /voters/accounts/:address
      • GET: /voters/history/:address
      • GET: /voters/:proposalId
    • GovernanceService
      • GET: /governance/strike
      • GET: /governance/proposals
      • GET: /governance/proposal_vote_receipts
      • GET: /governance/accounts
    • UserHistoryService
      • GET: /user/history
    • LiquidationService
      • GET: /get_liquidators
      • GET: /get_liquidator:account
      • GET: /get_liquidator_detail:account
      • GET: /liquidator
    • Shared Data Types
  • ⌛Strike.js
    • Strike Constructor
    • API Methods
      • Account
      • sToken
      • Market History
      • Governance
    • sToken Methods
      • Supply
      • Redeem
      • Borrow
      • Repay Borrow
    • STRK Methods
      • To Checksum Address
      • Get Strk Balance
      • Get Strk Accrued
      • Claim Strk
      • Delegate
      • Delegate By Sig
      • Create Delegate Signature
    • Comptroller Methods
      • Enter Markets
      • Exit Market
    • Ethereum Methods
      • Read
      • Trx
      • Get Balance
    • Governance Methods
      • Cast Vote
      • Cast Vote By Sig
      • Create Vote Signature
    • Price Feed Methods
      • Get Price
    • Utility Methods
      • Get Address
      • Get ABI
      • Get Network Name With Chain ID
  • 🤑DeFi 3.0 Vault
  • 🍍Revenue Share Staking
  • 🔒Security
    • Formal Verification
    • Bug Bounty Program
    • Immunefi
Powered by GitBook
On this page

Was this helpful?

  1. STokens

Liquidate Borrow

PreviousTransferNextKey Events

Last updated 4 years ago

Was this helpful?

A user who has negative is subject to by other users of the protocol to return his/her account liquidity back to positive (i.e. above the collateral requirement). When a liquidation occurs, a liquidator may repay some or all of an outstanding borrow on behalf of a borrower and in return receive a discounted amount of collateral held by the borrower; this discount is defined as the liquidation incentive.

A liquidator may close up to a certain fixed percentage (i.e. close factor) of any individual outstanding borrow of the underwater account. Unlike in v1, liquidators must interact with each sToken contract in which they wish to repay a borrow and seize another asset as collateral. When collateral is seized, the liquidator is transferred sTokens, which they may redeem the same as if they had supplied the asset themselves. Users must approve each sToken contract before calling liquidate (i.e. on the borrowed asset which they are repaying), as they are transferring funds into the contract.

SErc20

function liquidateBorrow(address borrower, uint amount, address collateral) returns (uint)
  • msg.sender: The account which shall liquidate the borrower by repaying their debt and seizing their collateral.

  • borrower: The account with negative that shall be liquidated.

  • repayAmount: The amount of the borrowed asset to be repaid and converted into collateral, specified in units of the underlying borrowed asset.

  • sTokenCollateral: The address of the sToken currently held as collateral by a borrower, that the liquidator shall seize.

  • RETURN: 0 on success, otherwise an

Before supplying an asset, users must first the sToken to access their token balance.

SEther

function liquidateBorrow(address borrower, address sTokenCollateral) payable
  • msg.value [payable]: The amount of ether to be repaid and converted into collateral, in wei.

  • msg.sender: The account which shall liquidate the borrower by repaying their debt and seizing their collateral.

  • borrower: The account with negative that shall be liquidated.

  • sTokenCollateral: The address of the sToken currently held as collateral by a borrower, that the liquidator shall seize.

  • RETURN: No return, reverts on error.

Solidity

SEther sToken = SEther(0x3FDB...);
SErc20 sTokenCollateral = SErc20(0x3FDA...);
require(sToken.liquidateBorrow.value(100)(0xBorrower, sTokenCollateral) == 0, "borrower underwater??");

Web3 1.0

const sToken = SErc20.at(0x3FDA...);
const sTokenCollateral = SEther.at(0x3FDB...);
await sToken.methods.liquidateBorrow(0xBorrower, 33, sTokenCollateral).send({from: 0xLiquidator});
🎙️
account liquidity
liquidation
account liquidity
Error code
approve
account liquidity