https://github.com/morpho-org/morpho-offchain-examples
🏃 Learn how to interact off-chain with the Morpho-Compound protocol!
https://github.com/morpho-org/morpho-offchain-examples
Last synced: 12 months ago
JSON representation
🏃 Learn how to interact off-chain with the Morpho-Compound protocol!
- Host: GitHub
- URL: https://github.com/morpho-org/morpho-offchain-examples
- Owner: morpho-org
- Created: 2022-08-19T06:58:47.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-05T14:20:36.000Z (over 3 years ago)
- Last Synced: 2025-06-18T08:49:05.193Z (12 months ago)
- Language: JavaScript
- Size: 60.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Morpho-Compound Off-Chain Examples
Learn how to interact with the Morpho-Compound protocol off-chain using a Smart Contract!
## Installation
This example repository uses `yarn` to manage dependencies.
```bash
git clone git@github.com:morpho-labs/morpho-offchain-examples.git
cd morpho-offchain-examples
yarn
```
## Usage
Copy-paste `.env.example`, name it `.env` and fill it with the values you want to use:
- `PRIVATE_KEY`: the private key of the hot wallet you want to use to supply/borrow through Morpho (:warning: never provide a program with the private key to your personal wallet!)
- `RPC_URL`: the RPC url to use to query data from the blockchain (you can get a free one with main RPC providers: Alchemy, Infura, ...)
```bash
cp .env.example .env
```
## Examples
### Morpho-Compound
- [MorphoSupplier.js](./src/compoud/MorphoSupplier.js): query supply-related data & supply through Morpho-Compound using ethers.js
- [MorphoBorrower.js](./src/compoud/MorphoBorrower.js): query borrow-related data & borrow through Morpho-Compound using ethers.js
- [MorphoRewardsTracker.js](./src/compoud/MorphoRewardsTracker.js): query rewards-related data using ethers.js
### Morpho-Aave V2
- [MorphoSupplier.js](./src/aave-v2/MorphoSupplier.js): query supply-related data & supply through Morpho-Aave V2 using ethers.js
- [MorphoBorrower.js](./src/aave-v2/MorphoBorrower.js): query borrow-related data & borrow through Morpho-Aave V2 using ethers.js