This file contains 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
[tool.poetry] | |
name = "Flash_loan_arbritage" | |
version = "0.1.0" | |
description = "" | |
authors = ["Your Name <you@example.com>"] | |
readme = "README.md" | |
packages = [{include = "Flash_loan_arbritage"}] | |
[tool.poetry.dependencies] | |
python = ">=3.10,<3.11" |
This file contains 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: flash_loan_arbritage | |
plugins: | |
- name: solidity | |
- name: alchemy | |
- name: foundry | |
- name: infura | |
- name: etherscan | |
ethereum: | |
default_network: mainnet-fork | |
mainnet_fork: |
This file contains 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 ape import project | |
address = "0xdead" | |
#contract = project.ContractName.at(address) | |
contract = project.IUniswapV2Factory.at(address) | |
for logs in contract.PairCreated: | |
print(logs) |
This file contains 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
# create a interfaces folder inside the contracts folder & put the interfaces inside them | |
from ape import project | |
contract = project.contractName.at(contract_address) | |
# ex | |
uniswap_v2_router = project.ISwapV2Router02.at(Uniswap_V2_Router_address) |
This file contains 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 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 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 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 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 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) |