Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add "BUY EXACTTOKENS" function #415

Open
bobby4star opened this issue Dec 21, 2021 · 1 comment
Open

Please add "BUY EXACTTOKENS" function #415

bobby4star opened this issue Dec 21, 2021 · 1 comment

Comments

@bobby4star
Copy link

Hi Devs,

It would be awesome if you could update the limitswap bot to buy the exact amount of tokens specified, provided that the price/total amount in base is within a specified limit. This will be a great feature where a launch has a max buy limit of say 30,000 tokens, and would allow the bot to buy all 30,000 providing the account has sufficient funds. At the moment, with current bot, it is a guessing game on how much in BNB to buy with, and transactions can fail if sending too much, or can result in only a fraction of tokens being bought vs the maximum permitted amount.

Here I give a suggestion on how the tokens.json file could work:-

[
{

"ENABLED": "true",

"SYMBOL": "CAKE",
"ADDRESS": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",

"BUYAMOUNTINBASE": "0.00005",
"BUYPRICEINBASE":  "0",
"SELLPRICEINBASE": "11111",
"SLIPPAGE": "5",

"MAXTOKENS": "1",
"MOONBAG": "0",

"EXACT_TOKENS": "true",  (over-rides BUYAMOUNTINBASE and instead buys the EXACT_TOKENS at whatever the price is) 
"EXACT_TOKENS_BUY_AMOUNT": "enter exact number of tokens to purchase"
"EXACT_TOKENS_BUY_LIMIT_IN_BASE": "enter max buy amount limit in BNB/basepair, bot does not buy if total price of maxtokens is above this wallet funding limit"   (or omit this step and just let the tx fail if the wallet has insufficient funds)

"RUGDOC_CHECK": "true",
"BUYAFTER_XXX_SECONDS": "0",    
"MAX_FAILED_TRANSACTIONS_IN_A_ROW": "2",    

"LIQUIDITYCHECK": "false",
"LIQUIDITYAMOUNT": "100",
"LIQUIDITYINNATIVETOKEN": "true",
"USECUSTOMBASEPAIR": "false",
"BASESYMBOL": "BUSD",
"BASEADDRESS": "0xe9e7cea3dedca5984780bafc599bd69add087d56",

"SELLAMOUNTINTOKENS": "ALL",
"HASFEES": "false",
"GAS": "8",
"BOOSTPERCENT": "30",
"GASLIMIT": "1000000"

}
]

@johnl1824
Copy link

I think an issue with this is that some mempool and other bots can push the price up and your wallet may not have enough money to buy the amount of tokens you want. I think a possible work around could be something like this (exact # of tokens you want, amount of ETH/BNB you are willing to spend) and if the amount of ETH/BNB that we are willing to spent exceeds the cost of tokens at the time, then it will only buy with the amount of ETH/BNB needed to purchase the max buy. On the otherhand, if the price moves faster and the max # of tokens surpassed the amount of ETH/BNB you are willing to spend, then the bot will just purchase the max amount of ETH/BNB.

Ex. Max buy is 1,000,000 and costs 0.1 ETH at launch
We can assign it as (Exact # of tokens: 1,000,000) and Max ETH/BNB willing to spend (1 ETH)
If we are able to get max tokens (1,000,000) at 0.25 ETH, then the bot will submit 0.25 ETH in the TX, and the extra 0.75 will not be spent.
On the other hand, if the 1,000,000 tokens cost 2 ETH at the time that the buy will be submitted, the bot will spend the Max ETH/BNB that we assigned (1 ETH)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants