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 / withdrawBNB.js
Last active December 19, 2022 11:25
withdrawBNB
// EscrowBNBContract
// https://testnet.bscscan.com/address/0x3e8ae7bf5a73b23bfd48bb8362ed55df079d11db#code
// BSC
const BSCMainnetUrl = process.env.BSC_MAINNET_URL
const BSCTestnetUrl = process.env.BSC_TESTNET_URL
const BSCPrivateKey = process.env.PRIVATE_KEY_BSC;
const BSCProvider = new ethers.providers.JsonRpcProvider(BSCTestnetUrl)
const BSCWallet = new ethers.Wallet(BSCPrivateKey);
const BSCAccount = BSCWallet.connect(BSCProvider);
@korrio
korrio / decode.js
Created December 15, 2022 05:32
ChatGPT log on Ethereum Transaction Data Structure in NodeJS
const EthereumTx = require('ethereumjs-tx');
// raw transaction data
const rawTx = '0xf86d8202b28477359400825208944592d8f8d7b001e72cb26a73e4fa1806a51ac79d880de0b6b3a76400008025a028ef61340bd939bc2e7b2a7b190d114d4c7e8a3d80e95599b63f6821023a9c7f3cf3e1df715f0d5c5b5e8d8b82e3538abf2e5b08cc8c86905b776f5dbb82c7';
// create a new transaction object
const tx = new EthereumTx(rawTx);
// access the data fields of the transaction
console.log(`nonce: ${tx.nonce}`);
@korrio
korrio / TokenSwap.sol
Created December 15, 2022 04:45
ChatGPT swap token solidity
pragma solidity ^0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
contract TokenSwap {
// The contract maintains a mapping of user accounts to their token balances
mapping (address => uint256) public balances;
// The contract maintains a reference to the ERC20 token contract
// that is being swapped
@korrio
korrio / slot.js
Created December 4, 2022 04:15
slot.js
This file has been truncated, but you can view the full file.
(function(t, e, i) {
function n(i) {
var r = e[i];
if (!r) {
var s = t[i];
if (!s)
return;
var a = {};
r = e[i] = {
exports: a
@korrio
korrio / ModSalary.sol
Created April 13, 2021 07:05
ModSalary.sol
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
@korrio
korrio / console.js
Created October 25, 2022 09:15
Add timestamp to all subsequent console.logs
// Add timestamp to all subsequent console.logs
// One little two little three little dependency injections....
const origLog = console.log;
console.log = function (obj, ...placeholders) {
if (typeof obj === "string")
placeholders.unshift("[" + new Date().toISOString() + "] " + obj);
else {
// This handles console.log( object )
placeholders.unshift(obj);
placeholders.unshift("[" + new Date().toISOString() + "] %j");
@korrio
korrio / ACL.sol
Created May 26, 2022 05:01
ACL.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract MyToken is ERC721, Ownable {
mapping(address => bool) public minters;
@korrio
korrio / Arbitrage_Q4_2022.sol
Last active October 1, 2022 06:55
Arbitrage_Q4_2022.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
@korrio
korrio / OnlyFans.sol
Created September 18, 2022 04:03
OnlyFans.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
@korrio
korrio / random.sol
Last active July 6, 2022 06:31
random.sol
pragma solidity ^0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {