Skip to content

Instantly share code, notes, and snippets.

View helderjnpinto's full-sized avatar
☢️

ħþ helderjnpinto

☢️
View GitHub Profile
@helderjnpinto
helderjnpinto / memtester
Created November 15, 2022 14:46
memtester Asus tyf a 15
memtester version 4.5.1 (64-bit)
Copyright (C) 2001-2020 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).
pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 24576MB (25769803776 bytes)
got 24576MB (25769803776 bytes), trying mlock ...locked.
Loop 1/5:
Stuck Address : ok
@helderjnpinto
helderjnpinto / decode_ethers_revertReason.js
Created September 1, 2022 17:11
ethers decode revertReason besu ethereum
const { revertReason } = await ethers.provider.send('eth_getTransactionReceipt', [error.transaction.hash])
const output = revertReason.slice(2)
const strLen = parseInt(output.slice(8 + 64, 8 + 128), 16)
const reason = ethers.utils.toUtf8String('0x' + output.slice(8 + 128, 8 + 128 + (strLen * 2)))
console.log('🚀 ~ reason', reason)
console.log('with abi decoder', ethers.utils.defaultAbiCoder.decode(['string'], ethers.utils.hexDataSlice(revertReason, 4))[0])
@helderjnpinto
helderjnpinto / ArraysViews.sol
Created June 10, 2022 22:35
Working with views dinamic arrays in solidity
pragma solidity ^0.8.14;
// SPDX-License-Identifier: GPL-3.0
pragma experimental ABIEncoderV2;
contract Money {
struct People{
uint id;
string name;
uint amount;
}
mapping (uint => People) public peoples;
@helderjnpinto
helderjnpinto / contracts...5_ContractWallet.sol
Created May 11, 2022 15: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=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol";
abstract contract AUSD {
/**
* @dev Returns the cost of withdraw
* @param sig is the withdraw method signature
@helderjnpinto
helderjnpinto / contracts...earnw.sol
Created April 29, 2022 14:11
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=
// Sources flattened with hardhat v2.6.0 https://hardhat.org
// File contracts/IEarn.sol
pragma solidity ^0.8.0;
/**
* @title IEarn interface
* @dev Interface only available with stake and unstake methods used in FactoryEarnDepositRelayer
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
@helderjnpinto
helderjnpinto / IERC20.json
Created April 5, 2021 09:45
Simple ABI for ERC20
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
@helderjnpinto
helderjnpinto / balances query check.js
Last active March 10, 2021 10:41
eth-query / web3
const EthQuery = require('eth-query')
const axios = require('axios').default
// const _providerURL = 'https://rpc.tst.publicmint.io:8545/'
const _providerURL = 'http://localhost:8549/'
const engine = (payload, url = _providerURL) => {
const _headers = {
headers: {
'Content-Type': 'application/json',
@helderjnpinto
helderjnpinto / Socket reset
Created February 15, 2021 16:04
Socket reset
nioEventLoopGroup-3-3 | DEBUG | EthProtocolManager | Disconnecting from peer (0x01 TCP_SUBSYSTEM_ERROR), 1 peers left: EthPeers{connections=0x8e4edbad2073721578...}
2021-02-15 16:03:06.512+00:00 | vert.x-eventloop-thread-2 | DEBUG | RecursivePeerRefreshState | Received neighbours packet with 13 neighbours
2021-02-15 16:03:06.513+00:00 | vert.x-eventloop-thread-2 | DEBUG | RecursivePeerRefreshState | Initiating bonding round with 5 candidates
2021-02-15 16:03:06.628+00:00 | nioEventLoopGroup-3-4 | DEBUG | AbstractHandshakeHandler | Sending framed hello
2021-02-15 16:03:06.629+00:00 | nioEventLoopGroup-3-4 | DEBUG | AbstractHandshakeHandler | Successfully wrote hello message
2021-02-15 16:03:06.630+00:00 | nioEventLoopGroup-3-4 | DEBUG | DeFramer | Peer disconnected before sending HELLO. Reason: 0x04 TOO_MANY_PEERS
2021-02-15 16:03:06.630+00:00 | nioEventLoopGroup-3-4 | DEBUG | RlpxAgent | Failed to connect to peer 0x3f34008752dccff9ac41e2dc2e5b97813045adc7866f96fdfbd94431a5e71b30add1aeb67b26957425b695d080e391
@helderjnpinto
helderjnpinto / gist:faa4b09efe350dabe049c1a01823c83d
Created February 15, 2021 15:56
Caused by: org.hyperledger.besu.ethereum.p2p.rlpx.framing.FramingException: Snappy decompression failed
AbstractHandshakeHandler | Successfully wrote hello message
2021-02-15 15:28:14.771+00:00 | nioEventLoopGroup-3-5 | DEBUG | DeFramer | Peer disconnected before sending HELLO. Reason: 0x04 TOO_MANY_PEERS
2021-02-15 15:28:14.771+00:00 | nioEventLoopGroup-3-5 | DEBUG | RlpxAgent | Failed to connect to peer 0x2f29befcc8de01b085f061f9b3c4b1c1901f852327f9ebc285af0912f5272ddad4dcac128aaad8a8af40449f8eb4b8b8cbe9163a6bd12c8a1a0cd7ed2a0f07cb: org.hyperledger.besu.ethereum.p2p.network.exceptions.PeerDisconnectedException: Peer disconnected for reason: 0x04 TOO_MANY_PEERS
2021-02-15 15:28:14.777+00:00 | nioEventLoopGroup-3-6 | DEBUG | HandshakeHandlerOutbound | Wrote initial crypto handshake message to /100.26.22.218:30303.
2021-02-15 15:28:14.781+00:00 | nioEventLoopGroup-3-7 | DEBUG | HandshakeHandlerOutbound | Wrote initial crypto handshake message to /51.81.67.31:30304.
2021-02-15 15:28:14.807+00:00 | nioEventLoopGroup-3-2 | DEBUG | ApiHandler | Received Wire PING
2021-02-15 15:28:14.807+00:00 | nioEventLoopGroup-3