This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git rm -r --cached . && git add . && git commit -am "Remove ignored files" | |
echo "Now run git push to make the changes to the remove repo" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker images | grep "<none>" | awk '{print $3}' | xargs docker rmi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker images --format "{{.Repository}}:{{.Tag}}" | xargs -L1 docker pull | |
# then remove the "<none>" tagged images | |
docker images | grep "<none>" | awk '{print $3}' | xargs docker rmi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
value = Contract.methodName.encode_input() | |
print(value) | |
# wrong | |
# >> '0xa7a7e4e8' | |
value = Contract.methodName.encode_input() | |
# add padding to make it 32 bytes | |
value = value + "0" * (66 - len(value)) | |
print(value) | |
# correct | |
#>> '0xa7a7e4e800000000000000000000000000000000000000000000000000000000' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from brownie import web3 | |
value = 1 | |
# * convert it to bytes32 | |
value = value.to_bytes(32, byteorder="big") | |
>>> value | |
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' | |
>>> value.hex() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from brownie import web3 | |
web3.toInt(bytes32Data) | |
# ape | |
from ape import convert | |
convert(bytes32Data, int) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: simple_storage | |
plugins: | |
- name: solidity | |
version: 0.6.3 # version of the plugin | |
- name: ganache | |
- name: alchemy | |
- name: hardhat | |
# - name: ens | |
# - name: etherscan | |
ethereum: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- cmd: ganache-cli | |
cmd_settings: | |
accounts: 10 | |
evm_version: istanbul | |
fork: goerli | |
gas_limit: 12000000 | |
mnemonic: brownie | |
port: 8545 | |
host: http://127.0.0.1 | |
id: goerli-fork-local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from brownie import web3 | |
# wrong | |
print(web3.solidityKeccak(["uint256", "address", "uint256"],[2, "0x0000000000000000000000000000000000001337", 8948253]).hex()) | |
# >> 0x7c251610f9474d6a5f00096d05e0ae40e433cae67c90e400cf88aad9f24398ef | |
# right | |
from eth_abi import encode | |
encoded_data = encode( | |
["uint256", "address", "uint256"], | |
[2, "0x0000000000000000000000000000000000001337", 8948253], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sha3 | |
from ecdsa import SigningKey, SECP256k1 | |
# Create a keccak_256 hash object | |
keccak = sha3.keccak_256() | |
# Generate a new private key using the SECP256k1 curve | |
private = SigningKey.generate(curve=SECP256k1) | |
# Get the corresponding public key in bytes format |