0

I have a need. Users participated in airdrop, sending tokens to over 50000 wallets constitute quite a fee. So we developed a medium for them to pay their gas fees themselves, and the rush was too much for the web3 server we used, thereby leading to some people not receiving tokens after payment and then a manual intervention clears the log. But this is a highly repeated scheme that needs proper automation.

Then we discussed and agreed with the community on a better proposal, since the token is currently been traded on exchange, we are planning on implementing a plan where all wallets and amounts are stored in a json file within the contract, and payments will trigger the amount of tokens to be sent to their wallets and the remainder fee will be sent to a liquidity in exchange.

I currently have a crowdsale contract that works, but not so sure how to implement this, especially the liquidity sending part.

I need guide, thank you in advance.

1 Answer 1

0

These are two separate questions, and this "thereby leading to some people not receiving tokens after payment" plus "I currently have a crowdsale contract" are unclear, as it sounds like you have a crowdsale that failed to distribute, not an airdrop that you pay to distribute. This: "after payment" should mean the blockchain received and processed the users' submission and took the gas for the TX, so all successful submitters should've received their tokens.

Regardless, the answers:

  1. "where all wallets and amounts are stored in a json file within the contract," You need a merkel tree airdrop. See https://github.com/Uniswap/merkle-distributor The scripts folder there will show you how to generate the merkle root from a json file.
  1. "the remainder fee will be sent to a liquidity in exchange" On transfer you want to first take whatever percent of tokens the fee is supposed to be, then use uniswap's swapExactTokensForETHSupportingFeeOnTransferTokens. It'll sell half the fee tokens at the current rate and pair them. Be mindful to set the original contract underlying balance (ETH, BNB) and subtract it from the total for the swap.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.