The previous repository structure can be found here
Hi! Originally this repo started as a bunch of scripts and examples, written for users while handling support queries as a contributor at Sushiswap. However the repository had grown to encompass many more protocols and areas of defi, as well as outgrowing its initial lack of structure.
To make it easier to find things that might be useful, as well to know which related scripts are worth skimming through. I have attempted to better organise into folders, adding an index with short descriptions.
Always love to hear which examples can been useful, and am often happy to take requests if you might be struggling with something. Can find me in the ethereum python discord with any questions. All the best on your journey. - Maka
folder | script | description |
---|---|---|
> aave | Aave lending protocol | |
v3_supply_and_withdraw.py | Approve, supply and withdraw from a v3 aave pool. | |
> beraswap | Berachain DEX | |
bera_swap.py | Swap using batchSwap with their ERC20_DEX . |
|
> flashbots | Call structures and direct calls to flashbots endpoints. | |
eth_send_bundle.py | Building and sending a classic bundle. | |
eth_send_private.py | Using Flashbots endpoint to send a private transaction. | |
mev_send_bundle.py | Building and sending a MevShare bundle. | |
> general | Overrides, bloom filters, log topics and wider EVM | |
bloom_filter.py | Filtering the logsBloom for more efficient searches. |
|
multi2.py | Using a popular mulicall contract, to batch static requests. | |
swap_topic.py | How to encode and pull an Event topic. |
|
transfer_override.py | Overriding an accounts ERC20 balance, prior to an eth_call . |
|
> raw_calls | Contract calls sending raw calldata | |
raw_approval.py | Send a token approval using pre prepared calldata. | |
raw_deploy.py | Deploy a contract using pre prepared calldata. | |
raw_deposit.py | Deposit ETH to receive WETH using pre prepared calldata. | |
raw_transfer.py | Make an ERC20 transfer using pre prepared calldata. | |
> scrapbots | Basic bot flow | |
skym_bot/ | Monitor a v2 pair for imbalance, skim with contract if so. | |
flash_bot.py | A basic flashbot script, using flashbots py library. | |
voly.py | Polls a v2 pair for price, buys or sells, tracks if holding. | |
> signing | Offchain signing, permits, EIP712 | |
pysign.py | Deprectated signing pattern. | |
setMasterContractApproval.py | Building and signing an EIP712 digest. | |
universal_permit2_extended.py | Offchain permit for Universal router (long way). | |
universal_permit2_abstract.py | Offchain permit for Universal router (short way). | |
> sushiswap | Sushi specific | |
exact_input.py | Trident single hop swap. | |
get_kava_farms.py | Get a list of all farms from a chef. | |
get_rewards.py | Calculating rewards from a Minichef. | |
graph_call.py | Outdated: Exchange subgraph call (Pre needing a key). | |
route_processor.md | Notes Sushi's router processor. | |
route_processor.py | Single hop swap using Sushi route processor. | |
route_processor_multi.py | Multi hop swap using Sushi route processor. | |
swap_volume_since_midnight.py | Outdated: Use a subgraph to get volume day data. | |
trident_help_sheet.md | Notes on Sushi Trident. | |
trident_multicall.py | Trident multi hop swap. | |
xSwap.py | Extensive cross chain swap, encoding, off chain signing etc. | |
> syncswap | How to swap on Syncwap DEX. | |
sync_swap.py | Basic Syncswap router interaction. | |
sync_swap_with_permit.py | Basic Syncswap router interaction using a permit. | |
> uniswapv2 | Examples for Uniswap v2 and clones | |
mempool_filter.py | IPC filter the tx pool for swaps and decode them. | |
scale4whale.py | Get an amount required to buy a tokens total supply. | |
v2path_encode.md | Step through of the ABI encoding. | |
> uniswapv3 | Examples for Uniswap v3 and clones | |
v3exactOutput.py | Uniswap v3 swap, multihop. | |
v3exactOutputSingle.py | Uniswap v3 swap, single hop. | |
v3quoter_iterations.py | Uniswap v3 quoter discrepancies, example calls to each. | |
> uni_router | Uniswaps Universal router | |
universal_router_swap.md | Notes on Uniswaps Universal Router. | |
universal_router_swap.py | Wrap and swap from Eth using Universal router.. | |
universal_swap_from_token.py | Swap from token using Universal router (uses dual tx permit). | |
universal_v2_swap.py | Swap on a v2 pool using Universal router (dual tx permit). | |
> zk | Anything ZK specific | |
check_balance.py | Simple balance check, using the sdk. | |
transfer.py | Simple eth transfer, using the sdk. | |