lending_user

class algofipy.lending.v2.lending_user.LendingUser(lending_client, address, storage_address=None)

Bases: object

get_market_page_offset(market_app_id)

Helper function that returns the location of the by-market state for the user

Parameters:

market_app_id (int) – the market app id for which the location is being calculated

Returns:

a tuple of page, offset ints

Return type:

tuple

get_preamble_txns(params, target_market_app_id, sender_address='')

Helper function that constructs a group representing the utility transactions that should precede some user calls to the algofi protocol markets

Parameters:
  • params (dict) – suggested params for the algod client

  • target_market_app_id (int) – the market contract for this group

  • sender_address – the address of the sender for the preamble transactions. This is helpful for liquidators, who are sending preamble transactions from their own accounts, targeting some user’s storage account

Returns:

preamble transaction group

Return type:

TransactionGroup

load_state(block=None)

Populates user state from the blockchain on the object

Parameters:

block (int, optional) – block at which to query the user local state

load_storage_state(storage_address, block=None)

Populates storage state from the blockchain on the object

Parameters:
  • storage_address (str) – storage account to query

  • block (int, optional) – block at which to query the user storage state