0

I need an api to handle erc20 ethereum token deposits and withdrawals on my microjobs website.

Users should be able to withdraw their earned token automatically when they pay the network fees.

Ismael
  • 30,570
  • 21
  • 53
  • 96
funcrypto
  • 1
  • 2
  • Do you create the microjobs / determine how much each pays? Or do users post microjobs to create a market place? – Steven V Jan 10 '20 at 23:22
  • Users create the microjobs to create the marketplace. They use the deposits to pay for the microjobs – funcrypto Jan 11 '20 at 08:49

1 Answers1

1

If you are using js, you can use ethers.js or web3.js to interact with the smart contracts when certain functions are needed.

Centralized Solution For a basic, centralized implementation (assuming an ERC20 smart contract has already been deployed and tokens have been minted / distributed) you and your users would interact with the transfer function.

On creating a microjob, the creator would use the transfer function to transfer the # of tokens that will be paid for the job to your site (either a general address treasury account or you could create an account per address). Once the use completes the form for this new job, you could request the user sign the transfer transaction. Now the job should exist in the microjobs database and your site will own the ERC20 tokens available.

When it has been determined the job has been completed - some one with access to the treasury account would sign a transaction paying out for the job.

Decentralized Solution A better way to complete this would like be creating a separate contract to manage the creation of MicroJobs and manage the erc20 tokens. In this solution when a job is created, the erc20 tokens would be transferred to this MicroJob smart contract. The creator of the job would then determine when the job is complete and trigger the payment from the MicroJobs contract to the user

Steven V
  • 1,461
  • 10
  • 15
  • The idea sound good to me, I will appreciate if you can send me a message here for further discussion because i cannot send you one. Alternatively we can chat on telegram @fortuneguy1 , I will appreciate if you can create the web3js codes for me since i do not have much knowledge about it. Thank you. – funcrypto Jan 11 '20 at 19:05
  • Here is the documentation for creating and interacting with a contract in web3.js - https://web3js.readthedocs.io/en/v1.2.4/web3-eth-contract.html# and ethers https://docs.ethers.io/ethers.js/html/api-contract.html# – Steven V Jan 11 '20 at 19:21
  • Thank you for the links shared, Please assist me with the codes and i will integrate it into my website, i am not into cryptocurrency as such. Please assist me. – funcrypto Jan 11 '20 at 20:08
  • Is there any standard web3js that I can edit to solve my problems ? – funcrypto Jan 12 '20 at 00:09
  • here are some examples of how this can be done: https://ethereum.stackexchange.com/questions/23121/how-to-transfer-erc20-tokens-using-web3js. The documentation above also has useful examples that can be adapted to ERC20 smart contracts – Steven V Jan 12 '20 at 02:33
  • Centralized Solution For a basic, centralized implementation (assuming an ERC20 smart contract has already been deployed and tokens have been minted / distributed) you and your users would interact with the transfer function. Can someone send me the web3js codes to complete the explained functions, withdrawal charges shall be in eth. Thank you. – funcrypto Jan 12 '20 at 07:28
  • I will appreciate if someone can share the codes with me and i will install web3js on my platform. I shall be grateful – funcrypto Jan 13 '20 at 09:51