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
// Slippage is defined in bps which means 100 is 1% so we gotta multiply by 100 | |
const getAmountOutJupyter = async (tokenA, tokenB, amount, slippage) => { | |
const url = `https://quote-api.jup.ag/v6/quote?inputMint=${tokenA}&outputMint=${tokenB}&amount=${Number(amount).toFixed(0)}&slippageBps=${slippage*100}` | |
let quote = null | |
try { | |
quote = await (await fetch(url)).json() | |
if (!quote) { | |
console.error('unable to quote') | |
return null | |
} |
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
// This is a basic uniswap frontrunning MEV bot | |
// Made by Merunas follow me on youtube to see how to use it and edit it: https://www.youtube.com/channel/UCJInIwgW1duAEnMHHxDK7XQ | |
// 1. Setup ethers, required variables, contracts and start function | |
const { Wallet, ethers } = require('ethers') | |
const { FlashbotsBundleProvider, FlashbotsBundleResolution } = require('@flashbots/ethers-provider-bundle') | |
// 1.1 Setup ABIs and Bytecodes | |
const UniswapAbi = [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesire |
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
await client.query({ | |
opportunities: [{ | |
first: 100, | |
}, { | |
farm: { | |
slug: true, | |
logo: true, | |
}, | |
totalValueLocked: true, | |
tokens: { |
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
// 1. Import everything | |
import { Wallet, BigNumber, ethers, providers } from 'ethers' | |
const { FlashbotsBundleProvider, FlashbotsBundleResolution } = require('@flashbots/ethers-provider-bundle') | |
/* | |
Mainnet | |
const provider = new providers.JsonRpcProvider('https://eth-mainnet.g.alchemy.com/v2/cmHEQqWnoliAP0lgTieeUtwHi0KxEOlh') | |
const wsProvider = new providers.WebSocketProvider('wss://eth-mainnet.g.alchemy.com/v2/cmHEQqWnoliAP0lgTieeUtwHi0KxEOlh') | |
*/ |
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
{ | |
"name": "My Generated NFT", | |
"description": "This is a generated NFT for testing purposes", | |
"external_url": "https://ipfs.io/ipfs/bafkreidhvbks723vbhipmxp4fv75yki7h2v3y3onbbnhisttg6iz3wnacq", | |
"image": "https://ipfs.io/ipfs/bafkreidhvbks723vbhipmxp4fv75yki7h2v3y3onbbnhisttg6iz3wnacq", | |
} |
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: MIT | |
pragma solidity ^0.8.0; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; | |
contract NFT is ERC721URIStorage { | |
constructor( | |
string memory _name, | |
string memory _symbol, |
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: GPL-2.0-or-later | |
pragma solidity 0.7.6; | |
pragma abicoder v2; | |
import "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol"; | |
interface IV3SwapRouter is IUniswapV3SwapCallback { | |
struct ExactInputSingleParams { | |
address tokenIn; | |
address tokenOut; | |
uint24 fee; | |
address recipient; |
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 fs = require('fs') | |
const { join } = require('path') | |
function getFirstGroup(regexp, str) { | |
return Array.from(str.matchAll(regexp), m => m[1]) | |
} | |
const file = fs.readFileSync(join(__dirname, 'code.txt'), 'utf-8') | |
const myRegex = /(.*)\n/g | |
let matches = file.matchAll(myRegex) |
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
* | |
font-family: 'roboto' | |
.header | |
display: flex | |
align-items: center | |
.title-container | |
width: 100% |
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
it("should write 3 words two times", async () => { | |
const deployerKeypair = anchor.web3.Keypair.generate() | |
const personThatPays = program.provider.wallet | |
// Add your test here | |
await program.rpc.initialize({ | |
accounts: { | |
article: deployerKeypair.publicKey, | |
personThatPays: personThatPays.publicKey, | |
systemProgram: anchor.web3.SystemProgram.programId, |
NewerOlder