Skip to content

Instantly share code, notes, and snippets.

View korrio's full-sized avatar
👽

kOrriO korrio

👽
  • Hal Finney Co.,Ltd.
  • mempool
  • X @korrio
View GitHub Profile
@korrio
korrio / DAI.sol
Created July 3, 2021 04:10
DAI.sol
pragma solidity ^0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/token/ERC20/ERC20.sol";
contract DAI is ERC20 {
constructor () public ERC20("Mocked DAI Token", "DAI-T") {
_mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
}
}
@korrio
korrio / BulkSender.sol
Created June 30, 2021 08:00
BulkSender.sol
// File: contracts/EternalStorage.sol
// Initial code from Roman Storm Multi Sender
// To Use this Dapp: https://bulktokensending.github.io/bulktokensending
pragma solidity ^0.6.6;
import 'VonderToken.sol';
/**
@korrio
korrio / pancake.js
Created June 29, 2021 06:54
pancake.js
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`);
@korrio
korrio / bot.js
Created June 28, 2021 10:10
bot.js
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 = {
@korrio
korrio / wrapUnwrap.js
Created June 19, 2021 05:30
wrapUnwrap.js
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])
@korrio
korrio / chainId.ts
Created June 16, 2021 08:26
chainId.ts
export enum ChainId {
Mainnet = 1,
Ropsten = 3,
Rinkeby = 4,
Goerli = 5,
Kovan = 42,
BSC = 56,
xDai = 100,
Polygon = 137,
Mumbai = 80001,
@korrio
korrio / SimpleBank.sol
Created June 16, 2021 06:35
SimpleBank.sol
// 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
@korrio
korrio / voted.sol
Created June 15, 2021 09:15
voted.sol
/**
*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.
@korrio
korrio / Bank.sol
Created June 15, 2021 06:10
Bank.sol
// 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.) */
@korrio
korrio / sendTransaction.js
Created June 11, 2021 10:31
sendTransaction.js
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,