Skip to content

Instantly share code, notes, and snippets.

View nCally's full-sized avatar
👋
Hey

Cally Nnamani nCally

👋
Hey
View GitHub Profile
@nCally
nCally / Deployer.s.sol
Created September 18, 2024 15:20
The Foundry Script File to deploy Uniswap V3 Fork
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.4.0;
import {Script, console} from "forge-std/Script.sol";
import {UniswapV3Factory} from "../lib/v3-core/contracts/UniswapV3Factory.sol";
import {UniswapV3Pool} from "../lib/v3-core/contracts/UniswapV3Pool.sol";
import {WRWA} from "../src/WRWA.sol";
import {NonfungiblePositionManager} from "../src/NonfungiblePositionManager.sol";
import {NonfungibleTokenPositionDescriptor} from "../src/NonfungibleTokenPositionDescriptor.sol";
import {SwapRouter} from "../lib/v3-periphery/contracts/SwapRouter.sol";
const sendSignedTransaction = async (
privateKey: string,
provider: string,
tx: any,
contractAddress: string) => {
const web3 = new Web3(provider);
const client = privateKeyToAddress(provider, privateKey);
const networkId = await web3.eth.net.getId();
const nonce = await web3.eth.getTransactionCount(client)
const CryptoJS = require('crypto-js')
const token = ""; // retrieve after login
const accessSecret = ""; // retrieve after login
const timestamp = Date.now()
let requestBody = {}
if(Object.keys(pm.request.body).length > 0){
requestBody = JSON.parse(pm.request.body)
export const setupWeb3 = (networkId: number) => {
let provider = '';
if (networkId === 97) {
provider = 'https://data-seed-prebsc-1-s1.binance.org:8545/';
}
if (networkId === 56) {
provider = 'https://bsc-dataseed1.ninicoin.io';
}
if (networkId === 137) {
const baseuri = Axios.create({
baseURL: `${chooseEnvironment().base}/api`,
headers: {
...getLocation(),
...getDeviceDetails(),
authorization: String(chooseEnvironment().auth),
authentication: `Basic ${retrieveToken().token}`,
},
});
@nCally
nCally / netrw.txt
Created June 11, 2022 06:59 — forked from danidiaz/netrw.txt
Vim's netrw commands.
--- ----------------- ----
Map Quick Explanation Link
--- ----------------- ----
< <F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file |netrw-cr|
<del> Netrw will attempt to remove the file/directory |netrw-del|
<c-h> Edit file hiding list |netrw-ctrl-h|
<c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
<c-r> Browse using a gvim server |netrw-ctrl-r|
<c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
export const sendSignedTransaction = async (tx, contractAddress) => {
const privatekey = ""; // your wallets secret key (very private, don't keep online)
const client = "";
const networkId = await web3.eth.net.getId();
const nonce = await web3.eth.getTransactionCount(client);
const gas = await tx.estimateGas({ from: client, nonce });
const gasPrice = await web3.eth.getGasPrice();
const data = tx.encodeABI();
@nCally
nCally / example.js
Last active June 27, 2021 18:59
Line 30 and 31 - Example how to use the function
import createContract from "../create.contract";
import EsusuService from '../abis/EsusuService.json';
import DAITokenAbi from '../abis/DaiContract.json';
import sendSignedTransaction from '../../utils/sendSignedTransaction';
import esusuInfo from './info';
export default async function (
cycleId: number,
provider: string,
@nCally
nCally / gist:87d6c27aff4ef5448ec737845e52194a
Created November 11, 2020 10:13
Where I call contract
import createEsusuContract from "./contract-creator";
import Groups from './abis/Groups.json';
import ADDRESS from "./abis/addresses";
async function getGroupsCount() {
const contract = await createEsusuContract(Groups.abi, ADDRESS.GROUPS);
@nCally
nCally / Groups.json
Last active November 11, 2020 10:11
Groups.json
{
"contractName": "Groups",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "oracle",
"type": "address"
}