0

Okay so I have deployed my contract to network, and my wallet or account via which I deployed it contains all my tokens of the newly created contract. I dont want to list my token anywhere since since only people who are in my app/website can purchase my tokens that's the business logic. so how could I obtain an automated process that if someone say wallet address 0xXYZ... transfers 0.001 eth to my wallet (plus gas) . Consider my token name Test is eqvivalent to 0.0001 eth so what i want is automatically transfer 9 (since 10 Test Token = 0.001 eth and assuming my gas on this transfer would be 0.0001 eth which is equal to 1 Test so 10 - 1 = 9 Test is to be transferred) Test tokens to 0xXYZ wallet. I can do this manually when I see the transfer in my wallet but I want this to be automated , i.e. the user is buying my token automatically. ERC20 based contract / token

I am new to this domain so I am not sure if this is possible or is this is allowed. I tried to find a lot but didnt find anything like this. Thanks in advance

2
  • Did you achieve it?
    – Saad Suri
    Jan 23, 2022 at 6:56
  • @SaadSuri i am working in web 2 domain now , its been quite time i left it, but since i didnt posted the answer, i didnt got it Feb 3, 2022 at 10:32

1 Answer 1

1

If I understand the question correctly, you want to automate the sale of the tokens.

You would create a sale contract with the sale logic. Such a contract would have a function to accept ETH and respond by transferring a corresponding amount of the tokens. It would also have a function to withdraw the ETH or else those ethers will be stranded in the contract. This withdrawal function would reject everyone except the owner or else those ethers will be taken by someone else.

For such a contract to work, it will also need a supply of the tokens, which you will transfer from your wallet. It's not necessary to transfer all of the tokens - just enough to meet demand. You may also decide you want a way to recover unsold tokens. This too would be built into the sale contract.

Hope it helps.

1
  • Hey can you share me some good blog/article/ any resource which I can follow for this particular need? like some of the articles are basic crowd sourcing kind of stuff but not exactly this type of thing. It would be great help. Thanks @Rob even this helped a lot Feb 27, 2019 at 12:59

Your Answer

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

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