Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def handle_transaction(tx):
# if(tx[u'to'] == KITTY_AUCTION):
# kitty_frontrun(tx)
if (tx[u'to'] == KITTY_CORE_CONTRACT):
kitty_instabid(tx)
def kitty_instabid(tx):
if (get_tx_method(tx) == CREATE_SALE_AUCTION):
generation, cooldown, price = get_kitty_params(tx)
gas_price = int(tx[u'gasPrice'], 16)
is_good_deal = price < calculateThresholdPrice(generation, cooldown)
if (is_good_deal):
try_buy_kitty(..., gas_price=gas_price) # buy in same block
await_confirmation(tx)
try_buy_kitty(..., gas_price=200 gwei) # buy in next block
while True:
tx = nextPendingTX()
handle_transaction(tx)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.