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
#!/usr/bin/env python3 | |
import requests | |
import os | |
def get_gas_price(): | |
""" | |
Gets current gas price using the Etherscan API | |
Returns price in gwei | |
""" |
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 { Button, Flex, Text, useToast } from '@chakra-ui/react' | |
import { useOnChange } from '@moleculexyz/common' | |
import { usePrivy } from '@privy-io/react-auth' | |
import { useRouter } from 'next/router' | |
import { useCallback, useMemo, useState } from 'react' | |
import { Address, Chain } from 'viem' | |
import { Alert } from '@/components/atoms/Alert' | |
import { BackButton } from '@/components/atoms/BackButton' | |
import { ContinueButton } from '@/components/atoms/ContinueButton' |
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
export const DEFAULT_CACHE_SECONDS = 15 | |
/** | |
* We're **not** using upstash or the Vercel KV SDK here to avoid package conflicts | |
* instead we're using vercel KV's REST API directly: https://vercel.com/docs/storage/vercel-kv/rest-api | |
*/ | |
const createClient = <T>({ token, url }: { token: string; url: string }) => { | |
return { | |
get: async (key: string): Promise<T | null> => { | |
const result = await ( |
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
contract SomeStore { | |
struct CatalystStorage { | |
uint64 x; | |
} | |
CatalystStorage public stg; | |
constructor() { | |
stg = CatalystStorage({x: 0}); | |
} |
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
// SPDX-License-Identifier: BUSL-1.1 | |
pragma solidity ^0.8.0; | |
/// @title Creates and initializes V3 Pools | |
/// @notice Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that | |
/// require the pool to exist. | |
interface IPoolInitializer { | |
/// @notice Creates a new pool if it does not exist, then initializes if not initialized | |
/// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool | |
/// @param token0 The contract address of token0 of the pool |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.25; | |
import { Test } from "forge-std/Test.sol"; | |
import "forge-std/console.sol"; | |
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | |
import { Address } from "@openzeppelin/contracts/utils/Address.sol"; | |
import { LinearCurve } from "../../src/curves/LinearCurve.sol"; | |
import { CurveParametersOutOfRange, TradeType } from "../../src/curves/IIPSeedCurve.sol"; | |
import { CommonTest, Defaults } from "../helpers/CommonTest.sol"; |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.25; | |
import { Test } from "forge-std/Test.sol"; | |
import "forge-std/console.sol"; | |
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | |
import { Address } from "@openzeppelin/contracts/utils/Address.sol"; | |
import { LinearCurve } from "../src/curves/LinearCurve.sol"; | |
import { CurveParametersOutOfRange, TradeType } from "../src/curves/IIPSeedCurve.sol"; | |
import { CommonTest, Defaults } from "./helpers/CommonTest.sol"; |
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
// Next14 adapted version of https://github.com/family/connectkit/blob/main/packages/connectkit-next-siwe/src/configureSIWE.tsx | |
import type { IncomingMessage, ServerResponse } from "http"; | |
import { | |
getIronSession, | |
IronSession, | |
SessionOptions as IronSessionOptions, | |
} from "iron-session"; | |
import { NextRequest, NextResponse } from "next/server"; | |
import { cookies } from "next/headers"; |
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
'use client' | |
import { getUnixTime, sub } from 'date-fns' | |
import { useCallback, useState } from 'react' | |
import { Address, decodeErrorResult, toHex, zeroAddress } from 'viem' | |
import { abi } from '@/lib/abi/EasyAuction' | |
import { useEasyAuctionInitiateAuction } from '@/lib/generated/wagmi/contracts' | |
import { Transaction } from '@/types/chain' | |
import { BID_CANCEL_DEADLINE_INTERVAL_HOURS } from '@/utils/auction' | |
import { currentChain, safeDecodeLogs } from '@/utils/chain' |
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
Stefan Adolf | |
Write a JavaScript program that renders a p5js image of a flower inside a browser context | |
Sure, here's an example of how to render a flower using p5js in a browser context: | |
html | |
Copy code | |
<!DOCTYPE html> | |
<html> | |
<head> |
NewerOlder