PToken

ReceiptVault is the market contract for a single asset. It holds underlying tokens, mints pTokens, tracks borrows, and applies interest. Each asset has its own vault instance.

circle-info

Responsibilities

  • Custody the underlying asset for one market.

  • Mint and burn pTokens for suppliers.

  • Track borrow balances and interest accrual.

  • Enforce caps, reserve factor, and admin fee.

  • Delegate risk checks to SimplePeridottroller.

Key Functions

  • deposit(user, amount) Transfers underlying from user, mints pTokens.

  • withdraw(user, ptoken_amount) Burns pTokens and returns underlying; checks liquidity via controller.

  • borrow(user, amount) Borrows underlying if controller allows.

  • repay(user, amount) Repays user debt (use a large amount for "max repay").

  • get_exchange_rate() Returns pToken → underlying exchange rate (scaled 1e6).

  • get_user_borrow_balance(user) Current borrow balance including accrued interest.

Events

  • Deposit

  • Withdraw

  • Borrow

  • Repay

  • FlashLoan

Last updated