Documentation

LendingCore

Private lending logic on Sapphire with confidential compute

Address (Sapphire Testnet): 0xF57a9FEAdCfb103ACC3f20a82F74858330b26862

Functions

processAction()

Process encrypted action - owner only

function processAction(bytes32 actionHash, bytes calldata encryptedPayload) external onlyOwner
Important

Only callable by owner (backend service). Decrypts and executes action in TEE.

getPosition()

Get user's private lending position

function getPosition(address user) external view returns (Position memory)

Returns encrypted position data, only readable by position owner

calculateHealthFactor()

Calculate user's health factor

function calculateHealthFactor(address user) external view returns (uint256)

Health factor = (Collateral * LTV) / Debt. Must be > 1.0 for borrows/withdraws.

updatePrice()

Update oracle prices - owner only

function updatePrice(address token, uint256 price) external onlyOwner

Action Types

SUPPLY (0)

Add collateral to position

BORROW (1)

Borrow against collateral

REPAY (2)

Repay borrowed amount

WITHDRAW (3)

Withdraw collateral

Events

event ActionProcessed(bytes32 indexed actionHash, address indexed user, uint8 actionType)
event PositionUpdated(address indexed user, uint256 collateral, uint256 debt)

Related