/**
* @notice Calculate COMP accrued by a supplier and possibly transfer it to them
* @param cToken The market in which the supplier is interacting
* @param supplier The address of the supplier to distribute COMP to
*/
function distributeSupplierComp(address cToken, address supplier) internal {
// TODO: Don't distribute supplier COMP if the user is not in the supplier market.
// This check should be as gas efficient as possible as distributeSupplierComp is called in many places.
// - We really don't want to call an external contract as that's quite expensive.
This file contains 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 Web3 = require('web3'); | |
// Initialize web3 instance | |
const web3 = new Web3('your rpc endpoint'); | |
async function getNFTsOwnedByAddress(contractAddress, ownerAddress) { | |
// Create a new contract instance | |
const contract = new web3.eth.Contract([ | |
{ | |
"anonymous": false, |
This file contains 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 { useAccount, useConnect } from "wagmi"; | |
import SendFunds from "./RareSend"; | |
import { useEffect } from "react"; | |
import styles from "@/styles/Home.module.css"; | |
import { MintNFT } from "./mint"; | |
export default function Home() { | |
const { connect, connectors } = useConnect(); | |
const { isConnected } = useAccount(); |
This file contains 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
// Initialize ethers.js and wagmi dependencies | |
import { ethers } from "ethers"; | |
import * as React from "react"; | |
import { | |
usePrepareContractWrite, | |
useContractWrite, | |
useWaitForTransaction, | |
} from "wagmi"; | |
import styles from "@/styles/Home.module.css"; |
This file contains 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 { useAccount, useConnect } from "wagmi"; | |
import SendFunds from "./RareSend"; | |
import { useEffect } from "react"; | |
import styles from "@/styles/Home.module.css"; | |
export default function Home() { | |
{ | |
/* some code... */ | |
} |
This file contains 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 { parseEther } from "ethers/lib/utils.js"; | |
import React, { useState } from "react"; | |
import { useDebounce } from "use-debounce"; | |
import { usePrepareSendTransaction, useSendTransaction } from "wagmi"; | |
import styles from "@/styles/Home.module.css"; | |
// what this does is simply disable the SendFunds function if the value passed is false | |
interface SendFundsProps { | |
disabled?: boolean; | |
} |
This file contains 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
.status { | |
text-align: left; | |
margin: 0px; | |
font-family: "Inter Medium", sans-serif; | |
} | |
.maincontainer { | |
position: absolute; | |
top: 50%; | |
left: 50%; |
This file contains 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 { useAccount, useConnect } from "wagmi"; | |
import { useEffect } from "react"; | |
import styles from "@/styles/Home.module.css"; | |
export default function Home() { | |
const { connect, connectors } = useConnect(); | |
const { isConnected } = useAccount(); | |
useEffect(() => { | |
console.log( |
This file contains 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 "@/styles/globals.css"; // CSS doesnt really matter now | |
import type { AppProps } from "next/app"; | |
import { WagmiConfig, configureChains, createClient, mainnet } from "wagmi"; | |
import { publicProvider } from "wagmi/providers/public"; | |
import { polygonMumbai } from "wagmi/chains"; | |
import { CoinbaseWalletConnector } from 'wagmi/connectors/coinbaseWallet' | |
import { InjectedConnector } from 'wagmi/connectors/injected' | |
import { MetaMaskConnector } from 'wagmi/connectors/metaMask' | |
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect' |
This file contains 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 Web3 = require('web3'); | |
const web3 = new Web3('https://rpc-endpoint'); | |
const contractAddress = '0x...'; // The address of the ERC20 contract | |
const contractAbi = [ | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, |
NewerOlder