Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cadence/contracts/mocks/MockOracle.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ access(all) contract MockOracle {
}
}

access(all) fun setPrice(forToken: Type, price: UFix64) {
access(all) fun setPrice(forToken: Type, price: UFix64?) {
self.mockedPrices[forToken] = price
}

Expand Down
16 changes: 16 additions & 0 deletions cadence/scripts/flow-alp/get_is_liquidatable.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import "FlowALPv0"

/// Returns whether a position is eligible for liquidation
///
/// A position is liquidatable when its health factor is below 1.0,
/// indicating it has crossed the global liquidation threshold.
///
/// @param pid: The unique identifier of the position.
/// @return `true` if the position can be liquidated, otherwise `false`.
access(all) fun main(pid: UInt64): Bool {
let protocolAddress = Type<@FlowALPv0.Pool>().address!
let pool = getAccount(protocolAddress).capabilities.borrow<&FlowALPv0.Pool>(FlowALPv0.PoolPublicPath)
?? panic("Could not find Pool at path \(FlowALPv0.PoolPublicPath)")

return pool.isLiquidatable(pid: pid)
}
Loading