> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Moonwell (moonwell)

> Lending protocol on Base. Compound V2 fork with governance and safety module features.

Lending protocol on Base. Compound V2 fork with governance and safety module features.

| Fact | Value |
| - | - |
| Category | Lending |
| Family | none |
| Namespace | `Moonwell` on base |
| Chains | base |

## Notes

* Same interface as Compound V2 (forked codebase)
* Must call `enterMarkets` on Comptroller before borrowing against any market
* Return values: 0 = success, non-zero = error code
* Base-only deployment

## Its names in a program

On Base, `Moonwell` is a namespace: its contracts need no import.

```ts theme={null}
function main() {
  // Base's comptroller, `0xfBb21d0380beE3312B33c4353c8936a0F13EF26C`.
  require(Moonwell.Comptroller != 0);
}
```

## Deployments

| Chain | Contract | Address | In a program |
| - | - | - | - |
| [Base](https://docs.eco.com/sauce-sdk/reference/chains/base.md) | comptroller | `0xfBb21d0380beE3312B33c4353c8936a0F13EF26C` | `Moonwell.Comptroller` |

## ABI

### `MTokenABI`

`import MTokenABI from "./protocols/moonwell/MTokenABI.json";`

* `mint(uint256 mintAmount) returns (uint256)`
* `redeem(uint256 redeemTokens) returns (uint256)`
* `redeemUnderlying(uint256 redeemAmount) returns (uint256)`
* `borrow(uint256 borrowAmount) returns (uint256)`
* `repayBorrow(uint256 repayAmount) returns (uint256)`

### `MoonwellComptrollerABI`

`import MoonwellComptrollerABI from "./protocols/moonwell/MoonwellComptrollerABI.json";` Speaks for: comptroller.

* `enterMarkets(address[] mTokens) returns (uint256[])`
* `exitMarket(address mToken) returns (uint256)`

## Next steps

* [Protocols](https://docs.eco.com/sauce-sdk/reference/protocols.md): the other protocols, by what they do.
* [Protocols and tokens](https://docs.eco.com/sauce/names.md): calling a contract by its namespace, or through its ABI.
* [Glossary](https://docs.eco.com/sauce/glossary.md): the words these pages use, in plain terms.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.