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 ethers = require(`ethers`) | |
const { ChainId, Token, TokenAmount, Fetcher, Pair, Route, Trade, TradeType, Percent } = | |
require(`@pancakeswap-libs/sdk`); | |
const Web3 = require(`web3`); | |
const { JsonRpcProvider } = require("@ethersproject/providers"); | |
require(“dotenv”).config() | |
const provider = new JsonRpcProvider(`https://bsc-dataseed1.binance.org/`); | |
const web3 = new Web3(`wss://apis.ankr.com/wss/c40792ffe3514537be9fb4109b32d257/946dd909d324e5a6caa2b72ba75c5799/binance/full/main`); |
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
import ethers from 'ethers'; | |
import express from 'express'; | |
import chalk from 'chalk'; | |
const app = express(); | |
// TUK-KKUB LP on Vonder: 0xFB74CAc28EE2635F08C22800CCFD5200cDe52DDF | |
const WETH = 'KKUB'; | |
const ERC20 = 'TUK'; | |
const data = { |
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
export default function useWrapCallback( | |
inputCurrency: Currency | undefined, | |
outputCurrency: Currency | undefined, | |
typedValue: string | undefined | |
): { wrapType: WrapType; execute?: undefined | (() => Promise<void>); inputError?: string } { | |
const { chainId, account } = useActiveWeb3React() | |
const wethContract = useWETHContract() | |
const balance = useCurrencyBalance(account ?? undefined, inputCurrency) | |
// we can always parse the amount typed as the input currency, since wrapping is 1:1 | |
const inputAmount = useMemo(() => tryParseAmount(typedValue, inputCurrency), [inputCurrency, typedValue]) |
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
export enum ChainId { | |
Mainnet = 1, | |
Ropsten = 3, | |
Rinkeby = 4, | |
Goerli = 5, | |
Kovan = 42, | |
BSC = 56, | |
xDai = 100, | |
Polygon = 137, | |
Mumbai = 80001, |
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.6.0; | |
/** | |
* @dev Wrappers over Solidity's arithmetic operations with added overflow | |
* checks. | |
* | |
* Arithmetic operations in Solidity wrap on overflow. This can easily result |
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
/** | |
*Submitted for verification at Etherscan.io on 2019-05-27 | |
*/ | |
pragma solidity ^0.5.0; | |
pragma experimental ABIEncoderV2; | |
// specifies what version of compiler this code will be compiled with | |
contract Voting { | |
/* the mapping field below is equivalent to an associative array or hash. |
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.6.0; | |
/// @title Bank | |
/// @author nemild, kor, tot | |
/* 'contract' has similarities to 'class' in other languages (class variables, | |
inheritance, etc.) */ |
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 drawing = async (privateKey) => { | |
console.log('Drawing...'); | |
const address = getUserAddress(privateKey); | |
const nonce = await web3.eth.getTransactionCount(address); | |
const gasPriceWei = await web3.eth.getGasPrice(); | |
const randomHex = Web3.utils.randomHex(32).substr(2); | |
const randomNumber = new BN(randomHex, 16).toString(); | |
const data = LotteryContract.methods.drawing(randomNumber).encodeABI(); | |
const signedTx = await web3.eth.accounts.signTransaction({ | |
to: contractAddress, |
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
➜ erc20-snapshot git:(master) ✗ node index.js | |
Error: overflow (fault="overflow", operation="toNumber", value="35000214728014336407470934256024915466671168103574785725052718905953538277376", code=NUMERIC_FAULT, version=bignumber/5.3.0) | |
at Logger.makeError (/Users/aq1/Desktop/init/snapshot/erc20-snapshot/node_modules/@ethersproject/logger/lib/index.js:187:21) | |
at Logger.throwError (/Users/aq1/Desktop/init/snapshot/erc20-snapshot/node_modules/@ethersproject/logger/lib/index.js:196:20) | |
at throwFault (/Users/aq1/Desktop/init/snapshot/erc20-snapshot/node_modules/@ethersproject/bignumber/lib/bignumber.js:305:19) | |
at BigNumber.toNumber (/Users/aq1/Desktop/init/snapshot/erc20-snapshot/node_modules/@ethersproject/bignumber/lib/bignumber.js:153:13) | |
at /Users/aq1/Desktop/init/snapshot/erc20-snapshot/node_modules/@ethersproject/abi/lib/coders/array.js:89:60 | |
at Array.forEach (<anonymous>) | |
at Object.unpack (/Users/aq1/Desktop/init/snapshot/erc20-snapshot/node_modules/@ethersproject/abi/lib/coders/ |
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": "PancakeSwap Default List", | |
"timestamp": "2021-03-17T09:56:23Z", | |
"version": { | |
"major": 2, | |
"minor": 7, | |
"patch": 0 | |
}, | |
"tags": {}, | |
"logoURI": "https://exchange.pancakeswap.finance/images/pancakeswap.png", |