Skip to content

Instantly share code, notes, and snippets.

@flashgrimmie
flashgrimmie / TestToken.sol
Last active March 13, 2025 17:23
erc20 token with tax
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
@flashgrimmie
flashgrimmie / transaction.js
Created October 18, 2021 20:48
Send transaction with web3 in nodejs
const Web3 = require('web3');
const Provider = require('@truffle/hdwallet-provider');
const MyContract = require('./build/contracts/MyContract.json');
const address = '';
const privateKey = '';
const infuraUrl = '';
// Very hard way (web3#signTransaction() + web3#sendSignedTransaction())
const init1 = async () => {
const web3 = new Web3(infuraUrl);
@flashgrimmie
flashgrimmie / docker-mongo-repair
Created August 9, 2021 19:37
Run "mongo --repair" in Docker container that cannot start because of MongoDB error
#!/bin/bash
# See https://github.com/docker-library/mongo/pull/63
docker run --rm --volumes-from my-mongo-server mongo unlink "/data/db/mongod.lock"
docker run --rm --volumes-from my-mongo-server mongo --repair