BytePhoenixCoding / BlockchainTokenSniper

Please see website / Telegram group for more details.
473 stars 286 forks source link

Feature: Extend decision logic to plugin #85

Closed hal0x2328 closed 2 years ago

hal0x2328 commented 2 years ago

It would be useful if the bot could make a synchronous call to an external program or Python script before making the final buy decision. This would allow bot users to add their own custom logic.

As one use case example, I've been compiling binary signatures of known honeypot contracts that could be avoided without any other mini-audit checks, so having a plugin that would enable me to skip the other checks in the case of a high-confidence match could save me a significant amount of API call quota.

Ideally there would be pre and post buy and sell hooks that would allow the plugin to alter the decision made by the bot in the most flexible manner. So ideally a plugin interface that looked something like:

def onPreAudit(token0, token1, lp_pair):
def onPostAudit(token, lp_pair, liquidity, buy_tax, sell_tax, ABI, is_verified, is_honeypot):
def onPostBuy(token, amount):
def onPreSell(token, amount):
def onPostSell(token, amount, profit): 

Then a user just builds a plugin named plugin.py or some standardized name with at least one of those handlers defined and adds it to the working directory.

onPreAudit/onPostAudit/onPreSell return True or False to alter the decision made by the bot. onPostBuy/onPostSell are strictly informational, to allow for webhooks or SMS messages to be sent.

BytePhoenixCoding commented 2 years ago

Tbh it's not a bad idea. But I think that'll have to wait until everything else is sorted first, its not really a priority atm.