Skip to content

Instantly share code, notes, and snippets.

@BlockmanCodes
BlockmanCodes / createUniswapPool.js
Last active August 19, 2023 18:53
Deploy Uniswap V3 Pool Ropsten
// SETUP
const { ethers } = require('ethers')
const axios = require('axios')
require('dotenv').config()
const UNISWAP_V3_FACTORY_ADDRESS = '0x1F98431c8aD98523631AE4a59f267346ea31F984'
const ROPSTEN_PROVIDER = new ethers.providers.JsonRpcProvider(process.env.INFURA_URL_ROPSTEN)
const WALLET_ADDRESS = process.env.WALLET_ADDRESS
@BlockmanCodes
BlockmanCodes / getPriceOracle.js
Last active July 12, 2024 07:57
Uniswap V3 Price Oracle in JavaScript
const { ethers } = require('ethers')
// IMPORTS AND SETUP
const JSBI = require('jsbi') // [email protected]
const { abi: IUniswapV3PoolABI } = require("@uniswap/v3-core/artifacts/contracts/interfaces/IUniswapV3Pool.sol/IUniswapV3Pool.json");
const { TickMath, FullMath } = require('@uniswap/v3-sdk')
require('dotenv').config()
const POOL_ADDRESS = '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640'
@BlockmanCodes
BlockmanCodes / Curl
Last active July 11, 2022 19:47
Forking mainnet
curl --location --request POST 'localhost:8545/' --header 'Content-Type: application/json' --data-raw '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
@BlockmanCodes
BlockmanCodes / 1_deploy.js
Last active June 21, 2022 12:56
Staking dapp
async function main() {
[signer1, signer2] = await ethers.getSigners();
const Staking = await ethers.getContractFactory('Staking', signer1);
staking = await Staking.deploy({
value: ethers.utils.parseEther('10')
});
console.log("Staking contract deployed to:", staking.address, "by", signer1.address)
@BlockmanCodes
BlockmanCodes / .env
Created May 22, 2022 14:31
Uniswap V3 AlphaRouter Example
WALLET_ADDRESS=
WALLET_SECRET=
INFURA_TEST_URL=
@BlockmanCodes
BlockmanCodes / client__package.json
Created May 15, 2022 13:50
Ether Donation Dapp
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.2.0",
"@testing-library/user-event": "^13.5.0",
"bootstrap": "^5.1.3",
"ethers": "^5.6.6",
@BlockmanCodes
BlockmanCodes / .env
Last active May 7, 2022 14:40
Decrease Liquidity
INFURA_URL_TESTNET=
WALLET_ADDRESS=
WALLET_SECRET=
@BlockmanCodes
BlockmanCodes / .env
Created May 3, 2022 21:30
Add liquidity to Uniswap V3
INFURA_URL_TESTNET=
WALLET_ADDRESS=
WALLET_SECRET=
INFURA_URL_TESTNET=
WALLET_ADDRESS=
WALLET_SECRET=
INFURA_URL_TESTNET=<your_url_and_key>