TransWikia.com

How to create withdraw token requests on my custom token sale dashboard

Ethereum Asked by Berk on December 20, 2021

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!

One Answer

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.

Answered by Shawn Tabrizi on December 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP