0

I created a token sale dashboard. Users can send BTC,LTC,ETH to dashboard. When user send BTC, LTC or ETH to dashboard, they get tokens to their dashboard budget (offchain) based on current token price.

I want to let users create token withdraw requests.
1. User created token withdraw request
2. Admin verified the request on admin panel.
3. Dashboard says ethereum network to "Send 1000 tokens to 0x... wallet address"
4. Transaction created.

Step 1 and 2 are Ok. I dont know how to do Step 3.

I deployed the token smart contract on Ropsten.

Users will tell "withdraw amount"(how many tokens) - "withdraw address"(user's personal wallet).

enter image description here

I dont know how to do that. Thank you!

0

Assuming that your token is a valid ERC-20 token, there are two functions you can use to send the tokens to a user.

The first option is a push model, where you call transfer(address to, uint tokens). Using this, you can send a specific amount of tokens you control to a specific address.

The other option is to have a pull model, where you call approve(address to, uint tokens). This function allows a specific address to then make a call to your contract using transferFrom(address from, address to, uint tokens) and pull a specific amount of tokens from your account to theirs.

It seems for your scenario, the first option is more along the lines of what you are looking for.

  • Thank you! I can transfer tokens between wallets via Matemask or myetherwallet but my question is how to execute transfer(address to, uint tokens) function from my dashboard. – Berk Aug 15 '18 at 17:55
  • You want something user initiated using JavaScript + Metamask? – Shawn Tabrizi Aug 15 '18 at 18:05
  • Something like altcoin exchange. User have 1000 Xtokens in his balance. And he wants to transfer money to his personal wallet.. (I added a picture to question) – Berk Aug 15 '18 at 18:14
  • But how are you tracking that user has "1000 XTokens". Is that stored in your smart contract? can you share your smart contract code? – Shawn Tabrizi Aug 15 '18 at 18:15
  • ropsten.etherscan.io/address/… I have the data "which user has how many tokens in his budget" on my database. – Berk Aug 15 '18 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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