> For the complete documentation index, see [llms.txt](https://docs.niftyapes.money/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.niftyapes.money/overview/contracts-and-security/liquidity.sol.md).

# Liquidity.sol

The deployed addresses for Liquidity.sol are:&#x20;

Rinkeby:\
\`Mainnet:

**ILquidity.sol**

Interface of the Liquidity.sol contract. Does not include restricted or optional functions. To view the full interface visit: link to interface on github. &#x20;

**Functions**

> `getCAsset(asset)`\
> `getCAssetBalance(account, cAsset)`\
> `supplyErc20(asset, amount)`\
> `supplyCErc20(cAsset, amount)`\
> `withdrawErc20(asset, amount)`\
> `withdrawCErc20(cAsset, amount)`\
> `supplyEth()`\
> `withdrawEth(amount)`\
> `assetAmountToCAssetAmount(asset, amount)`\
> `cAssetAmountToAssetAmount(cAsset, amount)`

**Events**

> `Erc20Supplied(liquidityProvider, asset, tokenAmount, cTokenAmount)`\
> `CErc20Supplied(liquidityProvider, cAsset, cTokenAmount)`\
> `Erc20Withdrawn(liquidityProvider, asset, tokenAmount, cTokenAmount)`\
> `CErc20Withdrawn(liquidityProvider, cAsset, cTokenAmount )`\
> `EthSupplied(liquidityProvider, amount, cTokenAmount);`\
> `EthWithdrawn(liquidityProvider, amount, cTokenAmount);`

**`Details`**

> `getCAsset(asset) -> address`\
> Returns the address of the cAsset associated to the underlying asset.

> `getCAssetBalance(account, cAsset) -> uint256`\
> Returns the cAsset balance of an account. This can be combined with cAssetAmountToAssetAmount() to get the accounts underlying balance.

> `supplyErc20(asset, amount) -> uint256`
>
> Returns the amount of cTokens minted and added to the lenders balance.
>
> Emits a Erc20Supplied() event.

> `supplyCErc20(cAsset, amount) -> uint256`
>
> Returns the amount of cTokens added to the lenders balance.
>
> Emits a CErc20Supplied() event.

> `withdrawErc20(asset, amount) - uint256`
>
> Returns the amount of cTokens`burned`and subtracted from the lenders balance.
>
> Emits a Erc20Withdrawn() event

> `withdrawCErc20(cAsset, amount) - uint256`
>
> Returns the amount of cTokens subtracted from the lenders balance.
>
> Emits a CErc20Withdrawn() event.

> `supplyEth() - > uint256`
>
> Returns the amount of cTokens minted and added to the lenders balance.
>
> Emits a EthSupplied() event.&#x20;

> `withdrawEth(amount) -> uint256`
>
> Returns the amount of cTokens`burned`and subtracted from the lenders balance.
>
> Emits a EthWithdrawn() event.

> `assetAmountToCAssetAmount(asset, amount) -> uint256`\
> Returns the amount of cAsset to be expected in a conversion from an underlying amount.

> `cAssetAmountToAssetAmount(cAsset, amount) -> uint256`
>
> Returns the amount of asset to be expected in a conversion from a cAsset amount. This function rounds at the 10th decimal and provides a slightly rounded, less-than-whole-number value. This results from Compound's cTokens having 8 decimal values.
