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
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: Type: 3,072-bit RSA
Comment: Fingerprint: 063E966C93AB4356492FE0327C3B4B4B7725111F
mQGNBGBUv08BDADTYA0GjLhbKbCezlVAubakXh0jcIbkqZPF1wueSbSgDjlS6+d8
67V6ft4hNXJhpNxqr07LrcbUEDdB7WK8EUA9qsLtVRznR/B8y2HwrFs7jbYAUzl6
lZ6UgzXl2QCeKI3B3foa7aGDeBkm1um3zXlR4+b8d4krO8pZTJepC5T+UF3C81Kb
lV+6s+bSsHPtLHwBh+tJtSFF7hQoU1lhVW0hKVGUUwGfoFuYjWh47fLtiEvvtM2e
EUZ/0v9nMTKg+tuk4nrR7J+ARdDxaqDWLNTwzGvuTAgkjw6I+zrzFmgsAbdFLFKE
@pcaversaccio
pcaversaccio / GUIDELINES.md
Last active March 16, 2024 10:34
Guide to get started with Vyper modules.

🐍 How to get started with Vyper modules

1. Create a new, clean testing directory test

mkdir test
cd test

2. Set up pyenv

# pragma version ^0.3.10
"""
@title P256 Signature Verification Function
@custom:contract-name P256Verifier
@license GNU Affero General Public License v3.0 only
@author pcaversaccio
@notice The `verify` function can be used to natively (currently
only supported on Polygon Mumbai test network) verify a
P256 (a.k.a. secp256r1 elliptic curve) signature. For more
technical details, please refer to EIP-7212:
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/math/SafeMath.sol
// Original license: SPDX_License_Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
@pcaversaccio
pcaversaccio / README.md
Last active November 18, 2023 16:52
Set up the vast.ai instance with profanity2 (https://github.com/1inch/profanity2).

Setup

Update Linux

sudo apt update && sudo apt upgrade

Install build-essential Packages

@pcaversaccio
pcaversaccio / compute_create2_address_zksync.vy
Last active April 15, 2024 11:22
Calculate the `CREATE2` address on zkSync using Vyper.
# @version ^0.3.9
_CREATE2_PREFIX: constant(bytes32) = 0x2020dba91b30cc0006188af794c2fb30dd8520db7e2c088b7fc7c103c00ca494
@external
@pure
def compute_create2_address_zksync(salt: bytes32, bytecode_hash: bytes32, deployer: address, input: Bytes[4_096]=b"") -> address:
constructor_input_hash: bytes32 = keccak256(input)
@pcaversaccio
pcaversaccio / ERC2098.vy
Created July 17, 2023 15:41
A Vyper utility function that transforms a standard signature into an EIP-2098 (https://eips.ethereum.org/EIPS/eip-2098) compliant signature.
# @version ^0.3.9
@internal
@pure
def _to_2098_format(signature: Bytes[65]) -> Bytes[64]:
"""
@dev Transforms a standard signature into an EIP-2098
(https://eips.ethereum.org/EIPS/eip-2098) compliant
signature.
@param signature The secp256k1 64/65-bytes signature.
@pcaversaccio
pcaversaccio / to_checksum_name.py
Last active June 15, 2023 09:10
A Python script that converts a function name into a name convention based on a checksum approach.
from re import sub
from eth_utils import keccak
from caseconverter import camelcase, flatcase, macrocase, pascalcase, snakecase
"""
Biased Assumption: Every single word of an interface function, event or custom error definition,
or anything else contained in an interface definition and used as an identifier, is capitalised
and concatenated with an underscore before running `to_checksum_name`.
Examples: `TRANSFER_FROM`, `BALANCE_OF`, `$I_HATE_PHP`.
@pcaversaccio
pcaversaccio / bootnodes.txt
Last active May 4, 2023 10:52
An overview of the current IPs and locations of the CL bootnodes.
# CL mainnet bootnodes: https://github.com/eth-clients/eth2-networks/blob/master/shared/mainnet/bootstrap_nodes.txt.
### ENR
# Teku team's bootnodes
enr:-KG4QOtcP9X1FbIMOe17QNMKqDxCpm14jcX5tiOE4_TyMrFqbmhPZHK_ZPG2Gxb1GE2xdtodOfx9-cgvNtxnRyHEmC0ghGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQDE8KdiXNlY3AyNTZrMaEDhpehBDbZjM_L9ek699Y7vhUJ-eAdMyQW_Fil522Y0fODdGNwgiMog3VkcIIjKA
enr:-KG4QL-eqFoHy0cI31THvtZjpYUu_Jdw_MO7skQRJxY1g5HTN1A0epPCU6vi0gLGUgrzpU-ygeMSS8ewVxDpKfYmxMMGhGV0aDKQtTA_KgAAAAD__________4JpZIJ2NIJpcIQ2_DUbiXNlY3AyNTZrMaED8GJ2vzUqgL6-KD1xalo1CsmY4X1HaDnyl6Y_WayCo9GDdGNwgiMog3VkcIIjKA
# Prylab team's bootnodes
enr:-Ku4QImhMc1z8yCiNJ1TyUxdcfNucje3BGwEHzodEZUan8PherEo4sF7pPHPSIB1NNuSg5fZy7qFsjmUKs2ea1Whi0EBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQOVphkDqal4QzPMksc5wnpuC3gvSC8AfbFOnZY_On34wIN1ZHCCIyg
@pcaversaccio
pcaversaccio / isqrt.ipynb
Last active April 30, 2023 15:42
Example Jupyter Notebook using https://try.vyperlang.org.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.