This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ethers from "ethers"; | |
| const signer = new ethers.Wallet( | |
| "PRIVATE_KEY", | |
| new ethers.providers.JsonRpcBatchProvider("RPC_URL") | |
| ); | |
| const signerAddress = await signer.getAddress(); | |
| const cEthAddress = "0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ethers from "ethers"; | |
| const signer = new ethers.Wallet( | |
| "PRIVATE_KEY", | |
| new ethers.providers.JsonRpcBatchProvider("RPC_URL") | |
| ); | |
| const signerAddress = await signer.getAddress(); | |
| const cEthAddress = "0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: GNU AGPLv3 | |
| pragma solidity ^0.8.16; | |
| import {ILens} from "@morpho-dao/morpho-core-v1/contracts/compound/interfaces/ILens.sol"; | |
| contract MorphoRewardsTracker { | |
| address public constant CWBTC2 = 0xccF4429DB6322D5C611ee964527D42E5d685DD6a; | |
| address public constant LENS = 0x930f1b46e1D081Ec1524efD95752bE3eCe51EF67; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: GNU AGPLv3 | |
| pragma solidity ^0.8.16; | |
| import {ILens} from "@morpho-dao/morpho-core-v1/contracts/compound/interfaces/ILens.sol"; | |
| import {IMorpho} from "@morpho-dao/morpho-core-v1/contracts/compound/interfaces/IMorpho.sol"; | |
| import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
| import {CompoundMath} from "@morpho-dao/morpho-utils/src/math/CompoundMath.sol"; | |
| interface IWETH9 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: GNU AGPLv3 | |
| pragma solidity ^0.8.16; | |
| import {ILens} from "@morpho-dao/morpho-core-v1/contracts/compound/interfaces/ILens.sol"; | |
| import {IMorpho} from "@morpho-dao/morpho-core-v1/contracts/compound/interfaces/IMorpho.sol"; | |
| import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
| import {CompoundMath} from "@morpho-dao/morpho-utils/src/math/CompoundMath.sol"; | |
| interface IWETH9 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // we keep track of connections ourselves as suggested in peerjs's documentation | |
| addConnection: function (conn) { | |
| this.connections[conn.peer] = conn; | |
| this.updatePeerIds(); | |
| console.log(`Connected to ${conn.peer}!`); | |
| }, | |
| removeConnection: function (conn) { | |
| delete this.connections[conn.peer]; | |
| this.updatePeerIds(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const appPrefix = "secure-p2p-multichat-"; // the prefix we will preprend to usernames | |
| const oldChats = localStorage.getItem("chats"); | |
| const chats = oldChats ? JSON.parse(oldChats) : []; // oldChats may be undefined, which throws error if passed into JSON.parse | |
| const app = new Vue({ | |
| el: "#app", | |
| data: { | |
| screen: "login", // initialize at login screen | |
| usernameInput: localStorage.getItem("username"), // to load saved username |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="login" v-if="screen === 'login'"> | |
| <div class="container"> | |
| <h1>Enter your username</h1> | |
| <div class="row"> | |
| <form v-on:submit="submitLogin"> | |
| <div class="input-field col s8"> | |
| <input :disabled="loading" id="username" type="text" v-model="usernameInput" /> | |
| <label for="username">My username</label> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>Serverless, secure & persistent multichat</title> | |
| <!-- To efficiently implement sockets --> | |
| <script src="https://unpkg.com/peerjs@1.2.0/dist/peerjs.min.js"></script> | |
| <!-- To easily manage dynamic rendering --> | |
| <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> |