Skip to content

Instantly share code, notes, and snippets.

@makoto
makoto / contracts...4_TestCustomError .sol
Created May 4, 2022 22:23
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
error ErrorWithNoParams();
error ErrorWithParams(int x, string errorMessage);
contract TestCustomError {
address payable owner = payable(msg.sender);
function CustomErrorWithParamsView(int _x) external pure {
@makoto
makoto / contracts...4_TestCustomError .sol
Created May 4, 2022 22:13
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.4;
error ErrorWithNoParams();
error ErrorWithParams(int x, string errorMessage);
contract TestCustomError {
address payable owner = payable(msg.sender);
function CustomErrorNoParams() public {
revert ErrorWithNoParams();
@makoto
makoto / index.js
Last active December 23, 2020 17:40
const Web3 = require('web3')
const Web3Legacy = require('web3legacy')
console.log('web3 version', (new Web3()).version)
console.log('web3 legacy version', (new Web3Legacy()).version)
// Do "export INFURA_PROJECT_ID=YOURPROJECTID" on your terminal
const projectid = process.env.INFURA_PROJECT_ID
const endpoint = 'https://mainnet.infura.io/v3/' + projectid
const provider = new Web3.providers.HttpProvider(endpoint)
const legacyProvider = new Web3Legacy.providers.HttpProvider(endpoint)
const web3 = new Web3(provider)
@makoto
makoto / index.js
Last active March 27, 2019 22:16
contenthash
const namehash = require('eth-ens-namehash').hash
document.querySelector('input').value = 'matoken.eth'
window.namehash = namehash
var sayHello = function(){
var name = document.querySelector('input').value
console.log(namehash(name))
}
makoto@Makotos-MacBook-Air: [~/src/tmp/univesal - (master)] $ more package.json
{
"name": "univesal",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start:dev": "universal-login start:dev"
},
makoto@Makotos-MacBook-Air: [~/src/tmp/univesal - (master)] $ more package.json
{
"name": "univesal",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start:dev": "universal-login start:dev"
},
@makoto
makoto / myth.log
Created July 9, 2018 17:17
myth.log
makoto@Makotos-MacBook-Air: [~/work/blockparty - (coverage)] $ myth -x contracts/Conference.sol
==== Integer Overflow ====
Type: Warning
Contract: Unknown
Function name: _function_0x05f203d9
PC address: 543
A possible integer overflow exists in the function `_function_0x05f203d9`.
makoto@Makotos-MacBook-Air: [~/work/ens/dnsprove-js - (dnsprove)] $ ls node_modules/@ensdomains/dnssec-oracle/contracts/RSASHA1Algorithm.sol
node_modules/@ensdomains/dnssec-oracle/contracts/RSASHA1Algorithm.sol
makoto@Makotos-MacBook-Air: [~/work/ens/dnsprove-js - (dnsprove)] $ ls node_modules/dnssec-oracle/contracts/RSASHA1Algorithm.sol
node_modules/dnssec-oracle/contracts/RSASHA1Algorithm.sol
makoto@Makotos-MacBook-Air: [~/work/ens/dnsprove-js - (dnsprove)] $ node inspect node_modules/.bin/truffle migrate
< Debugger listening on ws://127.0.0.1:9229/12a647df-fb0d-45da-a906-0db3172da72b
< For help see https://nodejs.org/en/docs/inspector
< Debugger attached.
debug> c
Break on start in node_modules/truffle/build/cli.bundled.js:1