state we are trying to format
a formatted version of state after taking care of decoding and unecessary key values
Return the value for the associated key in the object passed in , or defaultValue if not found
object to parse
key to find value for
default value to default to when we can't find key
the value for the associated key in the object passed in , or defaultValue if not found
Returns dict of global state for application with the given appId
algod client
id of the application
dict of global state for application with id appId
Returns init round of algofi protocol for a specified chain. Pulled from hardcoded values in contracts.ts.
network to query data for
init round of algofi protocol on specified chain
Returns a transaction group object representing the initial transactions executed by the algofi protocol during a standard group transaction. The transactions are (1) fetch market variables, (2) update prices, (3) update protocol data, and (4) degenerate ("dummy") transactions to increase the number of cost units allowed (currently each transactions affords 700 additional cost units).
transactions enum representing the group transaction the init transactions are used for
account address for the sender
suggested transaction params
id of the manager application
list of supported market application ids
list of supported oracle application ids
account address for the storage account
account address for the storage account
Returns app id of manager for the specified chain. Pulled from hardcoded values in contracts.ts.
network to query data for
manager app id
Returns market app id of symbol for the specified chain. Pulled from hardcoded values in contracts.ts.
network to query data for
symbol to get market data for
market app id
Returns a three element list with a new key, address and passphrase.
a three element list with a new key, address and passphrase.
Returns list of supported symbols for the specified chain. Pulled from hardcoded values in contracts.ts.
network to query data for
max assets
list of supported symbols for algofi's protocol on chain
Return a random integer between 0 and max
max integer that we want to return
random integer between 0 and max
Returns list of supported staking contracts for the specified chain. Pulled from hardcoded values in contracts.ts.
network to query data for
list of supported staking contracts
Return a byte representation of the passed in number
number to convert to bytes
a byte representation of the passed in number
Creates a new generic mainnet client
Algod client for interacting with the network
Indexer client for interacting with the network
address of the user
a new and fully constructed algofi mainnet client
Creates a new generic testnet client
Algod client for interacting with the network
Indexer client for interacting with the network
address of the user
a new and fuilly constructed algofi testnet client
Returns a TransactionGroup object representing an add collateral group transaction against the algofi protocol. Sender adds bank assets to collateral by sending them to the account address of the market application that generates the bank assets.
account address for the sender
suggested transaction params
storage account address for the sender
amount of bank asset to add to collateral
asset ids of the bank asset
id of the manager application
id of the market application for the bank asset
account address for the market application
list of supported market application ids
list of supported oracle application ids
TransactionGroup object representing an add collateral group transaction
Returns a transaction group object representing an asset opt in group transaction.
id of the asset to opt into
account address for the sender
suggested transaction params
transaction group object representing an asset opt in group transaction
Returns a transaction group object representing an borrow group transaction against the algofi protocol. Protocol sends requested borrow asset to the sender account provided sufficient collateral has been posted
account address for the sender
suggested transaction params
storage address for the sender
amount of asset to borrow
asset id of the asset to be borrowed
id of the manager application
id of the market application for the borrow asset
list of supported market application ids
list of supported oracle applicaiton ids
transaction group representing a borrow group transaction
Returns a transaction group object representing a burn group transaction against the algofi protocol. Sender burns bank assets by sending them to the account address of the market application for the bank asset which in turn converts them to their underlying asset and sends back.
account address for the sender
suggested transaction params
storage account address for sender
amount of bank asset to burn
asset id of the bank asset's underlying asset
id of the bank asset to burn
id of the manager application
id of the amrekt application for the bank asset
account address for the market application
list of supported market application ids
list of supported oracle app ids
transaction group object representing a burn group transaction
Returns a :class:TransactionGroup
object representing a claim rewards
underlying group transaction against the algofi protocol. The sender requests
to claim rewards from the manager acount. If not, the account sends
back the user the amount of asset underlying their posted collateral.
account address for the sender
suggested transaction params
storage account address for sender
id of the manager application
list of supported market application ids
list of supported oracle application ids
list of rewards assets in the staking contract
transaction group object representing a claim rewards transaction
Returns a transaction group object representing a claim rewards underlying group transaction against the algofi protocol. The sender requests to claim rewards from the manager acount. If not, the account sends back the user the amount of asset underlying their posted collateral.
account address for the sender
suggested transaction params
astorage account address for sender
id of the manager application
id of the market application of the collateral
id of the oracle application
list of reward assets in the staking contract
transaction group obejct representing a claim rewards transaction
Returns a transaction group object representing a liquidation group transaction against the algofi protocol. The sender (liquidator) repays up to 50% of the liquidatee's outstanding borrow and takes collateral of the liquidatee at a premium defined by the market. The liquidator first sends borrow assets to the account address of the borrow market. Then, the account of the collateral market is authorized to credit the liquidator with a greater value of the liquidatee's collateral. The liquidator can then remove collateral to underlying to convert the collateral to assets.
-account address for the sender
suggested transaction params
storage account address for sender (liquidator)
storage account address for liquidatee
amount of borrow the liquidator repays
id of the manager application
id of the borrow market application
account address of the borrow market
id of the collateral market application
list of supported market application ids
list of supported oracle application ids
id of the collateral bank asset
id of the borrow asset, defaults to algo
transaction group object representing a liquidate group transaction
Returns a transactiong roup object representing a manager opt in group transaction. The sender and storage account opt in to the manager application and the storage account is rekeyed to the manager account address, rendering it unable to be transacted against by the sender and therefore immutable.
id of the manager application
max opt in market app ids
account address for the sender
address of the storage account
suggested transaction params
transaction group object representing a managet opt in group transaction
Returns a transaction group object representing a market opt in group transaction.
-id of the market application
account address for the sender
suggested transaction params
transaction group object representing a market opt in group transaction
Returns a transaction group object representing a mint to collateral group transaction against the algofi protocol. Functionality equivalent to mint + add_collateral. The sender sends assets to the account of the asset market application which then calculates and credits the user with an amount of collateral.
account address for the sender
suggested transaction params
storage account address for sender
amount of asset to supply for minting collateral
id of the manager application
id of the asset market application
account address for the market application
list of supported market application ids
list of supported oracle application ids
asset id of the asset being supplied, defaults to algo
transaction group representing a mitn to collateral group transaction
Returns a transaction group object representing a mint group
transaction against the algofi protocol. bAssets are not automatically
posted to collateral as in prepare_mint_to_collateral_transactions
.
Sender sends assets to the account of the asset market application which
then sends an amount of market bank assets to the user.
account address for the sender
suggested transaction params
storage account address for sender
amount of asset to supply for minting bank assets
asset id of the bank asset to be minted
id of the manager application
id of the market application for the bank asset
account address for the market application
list of supported market application ids
list of supported oracle application ids
asset id of the asset being supplied, defaults to algo
transaction group object representing a mint group transaction
Returns a transaction group object representing a payment group transaction for a given sender, receiver, amount and ability to rekey.
account address for sender
suggested transaction params
account address for the receiver
amount of algos to send
Returns a transaction group object representing a remove collateral group transaction against the algofi protocol. The sender requests to remove collateral from a market acount after which the application determines if the removal puts the sender's health ratio below 1. If not, the account sends back the user the amount of bank assets requested.
account address for the sender
suggested transaction params
storage account address for sender
amount of bank asset collateral to remove from market
asset id of bank asset collateral
id of the manager application
id of the market application of the collateral
list of supported market application ids
list of supported oracle application ids
transaction group object representing a remove collateral group transaction
Returns a transaction group object representing a remove collateral underlying group transaction against the algofi protocol. Functionally equivalent to remove collateral + burn. The sender requests to remove collateral from a market acount after which the application determines if the removal puts the sender's health ratio below 1. If not, the account sends back the user the amount of asset underlying their posted collateral.
account address for the sender
suggested transaction params
storage account address for sender
amount of collateral to remove from the market
asset id of the asset underlying the collateral
id of the manager application
id of the market application of the collateral
list of supported market application ids
list of supported oracle application ids
transaction group object representing a remove collateral underlying group transaction
Returns a transaction group object representing a repay borrow group transaction against the algofi protocol. The sender repays assets to the market of the borrow asset after which the market application decreases the outstanding borrow amount for the sender.
account address for sender
suggested transaction params
storage account address for sender
amoutn of borrow asset to repay
id of the manager application
id of the market application of the borrow asset
account address for the market application
list of supported market application ids
list of supported oracle application ids
asset id of the borrow asset, defaults to algo
transaction group object representing a repay borrow group transaction
Returns a transaction group object representing a stake transaction against the algofi protocol. The sender sends assets to the staking account and is credited with a stake.
account address for the sender
suggested transaction params
storage account address for sender
amount of asset to supply for minting collateral
id of the manager application
id of the asset market application
account address for the market application
id of the aset market application
asset id of the asset being supplied, defaults to algo
transaction group object representing a mint to collateral group transaction
Returns a transaction group object representing a staking contract opt in group transaction. The sender and storage account opt in to the staking application and the storage account is rekeyed to the manager account address, rendering it unable to be transacted against by the sender and therefore immutable.
id of the manager application
id of the market application
account address of the sender
address of the storage account
suggested transaction params
transaction group object representing a manger opt in group transaction
Returns a :class:TransactionGroup
object representing a remove stake
group transaction against the algofi protocol. The sender requests to remove stake
from a stake acount and if successful, the stake is removed.
account addres for the sender
suggested transaction params
storage account address for sender
amount of collateral to remove from the market
id of the manager application
id of the market application of the collateral
id of the oracle application of the collateral
id of the asset to unstake
transaction group object representing a unstake group transaction
Returns dict of global state for application with id appId. Address must be that of the creator.
algod client
creator address
id of the application
dict of global state for application with id appId
Returns dict of local state for address for application with id appId
algod clietn
address of account for which to get state
is of the application
dict of local state of address for application with id appId
Returns value from the encoded global state dict of an application
global state of an application
utf8 key of a value to search for
value for the given key
Wait for the specified transaction to complete
algod client
transaction id of transaction we are waiting for
Generated using TypeDoc
Return a formatted version of state after taking care of decoding and unecessary key values