A Cloudflare Worker that provides real-time market and vault information for the Moonwell protocol on Base. This service fetches data from Moonwell's smart contracts using the Moonwell-SDK, processes it, and caches the results in Cloudflare R2 for efficient access.
- Real-time market and vault data from the Moonwell protocol
- Comprehensive yield information including APY/APRs
- Data caching with Cloudflare R2
- Modular code structure with TypeScript
- CORS-enabled API endpoint
Returns the current market and vault yield information.
Example response:
{
"markets": {
[marketKey: string]: {
"marketKey": string,
"deprecated": boolean,
"mintPaused": boolean,
"borrowPaused": boolean,
"seizePaused": boolean,
"transferPaused": boolean,
"marketToken": {
"address": string,
"name": string,
"symbol": string,
"decimals": number
},
"underlyingToken": {
"address": string,
"name": string,
"symbol": string,
"decimals": number
},
"collateralFactor": number,
"reserveFactor": number,
"exchangeRate": number,
"underlyingPrice": number,
"supplyCaps": {
"value": string,
"decimals": number
},
"supplyCapsUsd": number,
"borrowCaps": {
"value": string,
"decimals": number
},
"borrowCapsUsd": number,
"totalSupply": {
"value": string,
"decimals": number
},
"totalSupplyUsd": number,
"totalBorrows": {
"value": string,
"decimals": number
},
"totalBorrowsUsd": number,
"totalReserves": {
"value": string,
"decimals": number
},
"totalReservesUsd": number,
"cash": {
"value": string,
"decimals": number
},
"baseSupplyApy": number,
"baseBorrowApy": number,
"totalSupplyApr": number,
"totalBorrowApr": number,
"rewards": [
{
"token": {
"address": string,
"name": string,
"symbol": string,
"decimals": number
},
"supplyApr": number,
"borrowApr": number,
"liquidStakingApr": number
}
]
}
},
"vaults": {
[vaultKey: string]: {
"vaultKey": string,
"vaultToken": {
"address": string,
"name": string,
"symbol": string,
"decimals": number
},
"underlyingToken": {
"address": string,
"name": string,
"symbol": string,
"decimals": number
},
"underlyingPrice": number,
"baseApy": number,
"totalApy": number,
"rewardsApy": number,
"curators": string[],
"performanceFee": number,
"timelock": number,
"totalLiquidity": {
"value": string,
"decimals": number
},
"totalLiquidityUsd": number,
"totalSupply": {
"value": string,
"decimals": number
},
"totalSupplyUsd": number,
"market": {
"marketKey": string,
"collateralFactor": number,
"underlyingToken": {
"address": string,
"name": string,
"symbol": string,
"decimals": number
},
"totalSupply": {
"value": string,
"decimals": number
},
"totalBorrows": {
"value": string,
"decimals": number
},
"supplyApy": number,
"borrowApy": number
},
"rewards": [
{
"token": {
"address": string,
"name": string,
"symbol": string,
"decimals": number
},
"apy": number
}
]
}
}
}
- Node.js 16+
- npm or yarn
- Cloudflare Workers account
- Cloudflare R2 bucket
- Clone the repository
git clone <repository-url>
cd yield-backend
- Install dependencies
npm install
Run the development server:
npm run dev
Run the test suite:
npm test
Deploy to Cloudflare Workers:
npm run deploy