# Lending Protocols

Provides connectivity across the various **Lend and Borrow protocols** available on the EVM and Non-EVM chains.&#x20;

Following are the common functions implemented for all the Lend and Borrow protocols:-&#x20;

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td>getpool</td><td>Read</td><td>Get the lend and borrow APY for the given pool from the given protocol.</td></tr><tr><td>getpools</td><td>Read</td><td>Get the list of supply and borrow APYs of the mentioned assets.</td></tr><tr><td>getuseraccountdata</td><td>Read</td><td>Get the repay, borrow, withdraw amount and health factor details for the given user.</td></tr><tr><td>getuserpositions</td><td>Read</td><td>Retrieves the lending and borrowing positions of a user, including details such as token balances and collateral usage status.</td></tr><tr><td>entermarketstatus</td><td>Read</td><td>Check whether the user is approved before deposting.</td></tr><tr><td>getassetinfo</td><td>Read</td><td>Get the details of a specified asset like liquidation and borrow collateral factor, index and the price feed address. Available for Compound V3.</td></tr><tr><td>getclaimedrewards</td><td>Read</td><td>Get the rewards claimed by the specified account on the protocol. Available for Compound V3.</td></tr><tr><td>getmaxamounts</td><td>Read</td><td>Get the max withdrawable amount and the max borrowable amount of the base token for a given asset in the protocol for the specified account. Available for Compound V3.</td></tr><tr><td>getgovernordata</td><td>Read</td><td>Get the protocol and governor-related data for a market. Available for Compound V3.</td></tr><tr><td>allow</td><td>Write</td><td>Trigger a transaction on Compound V3 to allow or disallow the specified address to withdraw or transfer on behalf of the sender’s address.</td></tr><tr><td>claimrewards</td><td>Write</td><td>Trigger a transaction on Compound V3 to allow an account to claim rewards from the protocol.</td></tr><tr><td>deposit</td><td>Write</td><td>Trigger the deposit transaction from the given protocol.</td></tr><tr><td>transfer</td><td>Write</td><td>Trigger a transaction on Compound V3 to transfer an asset within the protocol to another account.</td></tr><tr><td>bundleactions</td><td>Write</td><td>Trigger a transaction on Compound V3 to pass an array of action codes and data <em>w.r.t</em> the action codes that are executed, one by one, in a single transaction.</td></tr><tr><td>borrow</td><td>Write</td><td>Trigger the borrow transaction from the given protocol. <br>Borrows the base token from specified market in case of Compound V3.</td></tr><tr><td>repay</td><td>Write</td><td>Trigger the repay transaction from the given protocol.</td></tr><tr><td>withdraw</td><td>Write</td><td>Trigger the withdrawal transaction from the given protocol.</td></tr><tr><td>migrate</td><td>Write</td><td>Trigger the migrate transaction for Aave v3.</td></tr><tr><td>setuseremode</td><td>Write</td><td>Trigger the E-Mode options for the user, on Aave v3.</td></tr><tr><td>exitisolationmode</td><td>Write</td><td>Trigger the exit of isolation mode options for the user, on Aave v3.</td></tr><tr><td>entermarket</td><td>Write</td><td>Trigger the approve transaction as Compound needs the user to approve before they can start deposit.</td></tr><tr><td>exitmarket</td><td>Write</td><td>Trigger the exit market transaction for Compound.</td></tr></tbody></table>

{% hint style="info" %}
Every protocol requires a different set of parameters to perform the common operations. Please refer to the sub-sections for details.&#x20;
{% endhint %}

Following is a sequence diagram for deposit() process in Compound:-

<figure><img src="https://680235803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaWFVt3vE2Ci7ngiL0xHe%2Fuploads%2Fi5YSA5BVr4GKOKI2K6OG%2FcompDepo.jpeg?alt=media&#x26;token=dcd6db98-a77a-414b-8a2b-e0c6c0f75f10" alt=""><figcaption><p>Sequence Diagram for deposit</p></figcaption></figure>

Following is a sequence diagram for deposit() process in Aave:-

<figure><img src="https://680235803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaWFVt3vE2Ci7ngiL0xHe%2Fuploads%2FPSZM0aYTsUygXOfqHRbV%2FAAVEDepo.jpeg?alt=media&#x26;token=45e485d7-785f-4291-a892-f8d621efda56" alt=""><figcaption><p>Sequence Diagram for deposit</p></figcaption></figure>

Following is a sequence diagram for borrow() process:-

<figure><img src="https://680235803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaWFVt3vE2Ci7ngiL0xHe%2Fuploads%2FsQolqsIw9M73PnE0Hffr%2FLBborrow.jpeg?alt=media&#x26;token=7f360f46-a959-44e3-8a28-fff755a1f9fa" alt=""><figcaption><p>Sequence Diagram for borrow</p></figcaption></figure>

Following is a sequence diagram for repay() process:-

<figure><img src="https://680235803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaWFVt3vE2Ci7ngiL0xHe%2Fuploads%2FOwAGv9BCflCCBx3hxdLc%2FLBrepay.jpeg?alt=media&#x26;token=0276db53-ec0b-48e8-903c-69a89644950c" alt=""><figcaption><p>Sequence Diagram for repay</p></figcaption></figure>

Following is a sequence diagram for withdraw() process:-

<figure><img src="https://680235803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaWFVt3vE2Ci7ngiL0xHe%2Fuploads%2FzuT1kQ2ibE81i4Yt9Umr%2FLBwithdraw.jpeg?alt=media&#x26;token=0a8e423c-c07d-483b-adde-9cb92d05ca91" alt=""><figcaption><p>Sequence Diagram for withdraw</p></figcaption></figure>
