Skip to content

Instantly share code, notes, and snippets.

View pcaversaccio's full-sized avatar
💯
Percent Commitment

sudo rm -rf --no-preserve-root / pcaversaccio

💯
Percent Commitment
View GitHub Profile
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreiebeiqfyvruwd6lxcdbsw6khotuf3r5pql22fnkzqntzsrbqgvjhq ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
@pcaversaccio
pcaversaccio / decompiled_EVM_bytecode.txt
Last active September 7, 2021 23:57
This is the decompiled EVM bytecode of 0x3a3051221174a2420a18504Ff39ae9FBB08AE024 using the Panoramix decompiler (https://github.com/eveem-org/panoramix)
#
# Panoramix v4 Oct 2019
# Decompiled source of 0x3a3051221174a2420a18504Ff39ae9FBB08AE024
#
# Let's make the world open source
#
#
# I failed with these:
# - unknown10d1e85c(?)
# - unknown5d0b1d4d(?)
@pcaversaccio
pcaversaccio / heist.py
Last active December 21, 2021 13:45
Generate private + public key + address BTC
#!/usr/bin/python3
import os
import time
import datetime as dt
import multiprocessing
from bitcoin import *
from mnemonic import Mnemonic
cores = 4
@pcaversaccio
pcaversaccio / GasTesting.sol
Last active March 20, 2023 19:44
A Solidity contract to estimate the used gas via the `gasleft()` syntax for dedicated function calls.
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
contract GasTesting {
function testInlined(uint256 length) external view returns (uint256 gasUsed) {
uint256 total;
uint256 startGas = gasleft();
for (uint256 i; i < length; i = _uncheckedInc(i)) {
total += i;
@pcaversaccio
pcaversaccio / decompiled_beanstalk_flash_loan_contract.txt
Last active April 22, 2022 11:40
Decompiled Beanstalk flash loan exploit contract 0x79224bC0bf70EC34F0ef56ed8251619499a59dEf. I used the Panoramix decompiler.
# I failed with these:
# - unknownfa461e33(?)
# All the rest is below.
#
def execute(address _target, bytes _data): # not payable
require calldata.size - 4 >=′ 64
require _target == _target
require _data <= 18446744073709551615
require _data + 35 <′ calldata.size
@pcaversaccio
pcaversaccio / decompiled_deus_finance_dao_attack_contract.txt
Created April 28, 2022 10:05
Decompiled DEUS Finance DAO attack contract 0x1f56CCfE85Dc55558603230D013E9F9BfE8E086C. I used the Panoramix decompiler.
# Palkeoramix decompiler.
def storage:
ownerAddress is addr at storage 0
stor1 is addr at storage 1
stor2 is addr at storage 2
stor3 is addr at storage 3
stor4 is addr at storage 4
stor5 is addr at storage 5
stor6 is addr at storage 6
@pcaversaccio
pcaversaccio / LookupContract.sol
Last active May 30, 2022 11:58
How to deploy a smart contract on Hedera using Hardhat.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract LookupContract {
mapping(string => uint256) public myDirectory;
constructor(string memory _name, uint256 _mobileNumber) {
myDirectory[_name] = _mobileNumber;
}
@pcaversaccio
pcaversaccio / Merge.sol
Last active September 13, 2022 19:19
This smart contract determines whether "The Merge" has already taken place or not.
// SPDX-License-Identifier: WTFPL
pragma solidity 0.8.16;
contract Merge {
uint72 private constant _DIFFICULTY_THRESHOLD = 2**64;
/**
* @dev A difficulty value greater than `2**64` indicates that a transaction is
* being executed in a PoS block. Also note that the `DIFFICULTY` opcode (0x44)
@pcaversaccio
pcaversaccio / ERC20Mock.sol
Last active June 12, 2022 17:28
An ERC20 mock contract that is deployed directly with Solidity using the `Create2Deployer`.
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
// Mock class using ERC20
contract ERC20Mock is ERC20 {
constructor(
string memory name,
string memory symbol,
@pcaversaccio
pcaversaccio / DoubleOrNothing.sol
Last active September 30, 2022 23:45
DoubleOrNothing: Send ETH to the contract and either get double back (if the randomness beacon + a pre-committed nonce is even) or lose the bet (if the randomness beacon + a pre-committed nonce is odd). The assumption is that the contract is sufficiently funded by enough lost bets!
// SPDX-License-Identifier: WTFPL
pragma solidity 0.8.17;
/**
* @dev Error that occurs when called by a contract account.
* @param emitter The contract that emits the error.
*/
error ContractCallsAreNotAllowed(address emitter);
/**