> For the complete documentation index, see [llms.txt](https://docs.expand.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.expand.network/~/changes/CwwHZ0oIeFsEWwiEWd1b/integrations/lend-and-borrow.md).

# Lend and Borrow

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, and withdraw amount details for the given user.</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>liquidate</td><td>Write</td><td>Trigger the liquidate transaction from the given protocol.</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="/files/bWfMadJ6bNQ5hTOx6jOl" alt=""><figcaption><p>Sequence Diagram for deposit</p></figcaption></figure>

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

<figure><img src="/files/tU7IUz3iqCh0Yw2bIoJL" alt=""><figcaption><p>Sequence Diagram for deposit</p></figcaption></figure>

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

<figure><img src="/files/c262d6w72EjrvTyvrxrh" alt=""><figcaption><p>Sequence Diagram for borrow</p></figcaption></figure>

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

<figure><img src="/files/dOggrjX8cIWRMiLkrk4Z" alt=""><figcaption><p>Sequence Diagram for liquidate</p></figcaption></figure>

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

<figure><img src="/files/kB9PE0TBpQWIprUqk87Y" alt=""><figcaption><p>Sequence Diagram for repay</p></figcaption></figure>

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

<figure><img src="/files/LMMmZJvJDgFTNiECWYFT" alt=""><figcaption><p>Sequence Diagram for withdraw</p></figcaption></figure>
