This file contains 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 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}`); |
This file contains 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
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 |
This file has been truncated, but you can view the full file.
This file contains 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
(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 |
This file contains 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
// 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"); |
This file contains 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.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; |
This file contains 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
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) { |
This file contains 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 fetch = require("node-fetch"); | |
async function ipfsPublish(fileName, data) { | |
const buffer = await Buffer.from(data); | |
return new Promise((resolve, reject) => { | |
fetch("https://ipfs.kleros.io/add", { | |
method: "POST", | |
body: JSON.stringify({ | |
fileName, |
This file contains 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.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; |
This file contains 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 2021-04-22 | |
*/ | |
// File: @openzeppelin/contracts/utils/Context.sol | |
// SPDX-License-Identifier: MIT | |
pragma solidity >=0.6.0 <0.8.0; |
This file contains 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; | |
library SafeMath { | |
/** | |
* @dev Returns the addition of two unsigned integers, reverting on | |
* overflow. | |
* | |
* Counterpart to Solidity's `+` operator. |