MyBitFoundation / MyBit-Network.tech

🔷 The MyBit Network™ technology - Smart contracts and APIs to interact with the MyBit ecosystem
https://tech.mybit.io
GNU General Public License v3.0
20 stars 19 forks source link

Develop Airdrop dApp #147

Closed mybit-bot closed 5 years ago

mybit-bot commented 6 years ago

Introduction: Dropzone is a simply web-interface for conducting crypto airdrops. This tasks involves combining the smart contracts with the design which components can be pulled from the UI Kit. The smart contracts are not finalised and solely serve to act as the building blocks for this use case.

Resources: general - https://files.mybit.io/files/ design - https://www.dropbox.com/s/pz8kdqwxqs6841b/MyBit-Dropzone-Micro-dApp %281%29.zip?dl=0 UI Kit - ui.mybit.io MyBit SDK - developer.mybit.io Smart Contracts - https://github.com/MyBitFoundation/MyBit-Dropzone.tech

Requirements of dApp:

  1. Force metamask login
  2. Enter amount of ETH and select recipient from dropdown. Initial dropdown will be for top 100 ETH addresses (this must be added to the smart contracts)
  3. receive airdrops should be removed from design
  4. airdrop tokens should be combined with sent airdrops and labeled sent airdrops and be a transaction ledger of sent airdrops.

To submit please initiate a pull request.

Disclaimer: All work completed via the MyBit Decentralised Development Fund is property of the MyBit Foundation (CHE-177.186.963) and may be used, re-used, and/or distributed, re-distributed by the MyBit Foundation for financial gain. The contributor holds no warrant nor claims for any future payments resulting from monetisation schemes originating from the MyBit Foundation or any of its affiliates. Where law permits outside of open source regulations, the contributor is not permitted to distribute any work completed via the MyBit Decentralised Development Fund (DDF) for personal gain.

status-open-bounty commented 6 years ago

Balance: 0 ETH Tokens: MYB: 210000.00 Contract address: 0x378f9d91b8880bdc17b6530432801cd50e22faa5 Network: Mainnet Paid to: pacamara Visit https://openbounty.status.im to learn more.

uivlis commented 5 years ago

Initial dropdown will be for top 100 ETH addresses

What is a top ETH address? One that holds the most ETH on the blockchain (or, perhaps, MYB)?

pacamara commented 5 years ago

@PeterMPhillips @kyledewy Hi! Have submitted PR with airdrop creation implemented and working (tested on local MyBit-Chain instance) : https://github.com/MyBitFoundation/MyBit-Dropzone.tech/pull/4

Now working on display of past transactions. Ropsten testing also a to-do. Have set it to airdrop MYB, is this correct?

pacamara commented 5 years ago

PR updated, Sent Airdrops page now implemented and working.

pacamara commented 5 years ago

@PeterMPhillips @kyledewy @jjperezaguinaga PR https://github.com/MyBitFoundation/MyBit-Dropzone.tech/pull/4 complete now, see ropsten demo in attached screen recording. Could you take a look please? :beers:

airdrop-demo180d

cryptnotiq commented 5 years ago

hey @pacamara could you share a staging URL so I can live test?

pacamara commented 5 years ago

@cryptnotiq Sure, will let you know once it's up :)

pacamara commented 5 years ago

@cryptnotiq OK it's https://dropzone-pr4-staging.herokuapp.com

It now airdrops the official MYB ropsten token, 0xbb07c8c6e7cd15e2e6f944a5c2cac056c5476151 , same as MyBit-Trust uses, and same as given out by the faucet.

Thanks! :beers:

cryptnotiq commented 5 years ago

@pacamara ok few things.

  1. Remove the head tab airdrop tokens
  2. In create new, should be able to add multiple recipient addresses manually. Easy way to do this is have a plus icon underneath the first recipient box and when clicked displays a second and so fourth. Importing a CSV would be a great addition as well but was not included in the scope of this task to my knowledge - but if you want to go above and beyond please do.
  3. Top 100 ETH addresses doesn't work - tried sending an airdrop there and it did not work.
  4. What are all the other addresses in the dropdown?

Let me know if you have any other questions.

pacamara commented 5 years ago

@cryptoniq Thanks for the review, got it. :) Will action 1, 2 and think about the csv option.

  1. "Top 100 eth addresses" airdrop works on ropsten. What happened when you tried? Perhaps you were out of gas or MYB?

  2. The other addresses in the dropdown are the individual addresses in the Top 100 eth addresses list (as taken off etherscan).

cryptnotiq commented 5 years ago

@pacamara 3. Nothing happens - don't get a metamask pop-up nor anything to confirm the transaction. Definitely have MYB and Gas

  1. You can remove all the addresses and just have the top 100 option in the dropdown.
pacamara commented 5 years ago

@cryptnotiq 3. Yes I see your ropsten account, lots of MYB and ETH! What OS/browser are you on?

Can you please try with my account 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1? "Top 100 eth" airdrops work consistently for me with it. Seed phrase is same as for local blockchain, i.e. myth like bonus scare over problem client lizard pioneer submit female collect

In meantime am adding extra logging to that staging instance.

cryptnotiq commented 5 years ago

@pacamara tried on Chrome and Firefox. @AspacehUK @kyledewy can you guys test out this dApp and see if it works for you? Specifically doing an airdrop to top 100 ETH addresses. For me it didn't work - didn't get a metamask pop-up.

Let's try that from our own accounts before trying to use yours bc that shouldn't be necessary.

0xdewy commented 5 years ago

Hey @pacamara I tried to create an airdrop for the top 100 addresses using the account you provided and a seperate account on both firefox and brave and the transaction isn't triggering metamask.

pacamara commented 5 years ago

@cryptnotiq @kyledewy Sorry to hear that! Have added a bunch of cloud-based logging to that instance now, so should be able to see what's going on. Could you try again please? (Better to use your own accounts now). Thanks! :beers:

cryptnotiq commented 5 years ago

@pacamara nope, still not triggering a metamask pop-up for me. Maybe you need to redeploy and update the staging URL to incorporate the updates?

pacamara commented 5 years ago

@cryptnotiq Thanks for trying again! To clarify, I had added cloud-based logging, not fixed the error. I see you in the logs (100MYB airdrop to top 100 eth) and here is the root cause error :

0x13D7e0 core.requestApproval: ERROR=Error: Error: [number-to-bn] while converting number 1e+22 to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported. Given va…

Similar to https://ethereum.stackexchange.com/questions/59122/web3-js-1-0-is-throwing-big-number-error-while-transfering-tokens Makes sense, up to now I hadn't tested with large amounts of MYB, apologies. I.e. all my 100-recipient airdrops had been for fractional amounts of MYB. Will fix and let you know when redeployed! :beers:

pacamara commented 5 years ago

@cryptnotiq That bug is fixed on the staging instance https://dropzone-pr4-staging.herokuapp.com , 100MYB airdrops to "Top 100 ETH addresses" work ok now. :) Example ropsten txn

0xdewy commented 5 years ago

@pacamara the airdrop worked for me, although it doesn't show up in the 'sent airdrops' tab after completing. Another thing is that it requested for me to approve the token transfer several times. Can you add a check to see if the token allowance is already higher than the burning fee?

pacamara commented 5 years ago

@kyledewy Cool, good to hear the airdrop works for you! Have added cloud logging to the Sent Airdrops page now, can you retry please?

Re. the requestApproval calls, it seems necessary to make separate calls for both the burner and airdrop contracts. I'll implement your suggestion. Is it right to say the long term solution is using approveAndCall? Per your comment in the contract:

// TODO: Decode bytes to do airdrop using approveAndCall() (single-transaction)

Am happy to implement that if required.

pacamara commented 5 years ago

PS. The airdrop contract is burning 250wei MYB, will correct this to 250MYB.

0xdewy commented 5 years ago

@pacamara ya you should be able to get away with just approving the airdrop contract to spend mybFee amount of tokens. approveAndCall() would be the ideal UX solution. Would be great to implement that, but we can do that in another bounty if your interested. It's not required for this one. Yes the fee needs updating in the contract. It should be 250 * 10^18 , but I would just pull the variable directly from the contract and approve() the airdrop contract for that amount.

pacamara commented 5 years ago

@kyledewy Got it, thanks for the pointers! :beers:

0xdewy commented 5 years ago

@pacamara Nice, the airdrops are showing up in the 'sent airdrops' screen for me now.

@cryptnotiq @AspacehUK can you give it a whirl and see if it's missing anything?

cryptnotiq commented 5 years ago

@kyledewy @pacamara still not triggering metamask when I select top 100.

@AspacehUK can you test it out?

pacamara commented 5 years ago

@kyledewy Yay!

@cryptnotiq Probably platform-related? @kyledewy and I both linux/firefox, you're OSX/Chrome. (Chrome works fine on linux). Suspect this error:

loadMetamaskUserDetails: error=Error: Couldn't decode uint256 from ABI: 0x

Also have these to-dos (so far):

Going to do these now, and troubleshoot the latest error. Cheers!

cryptnotiq commented 5 years ago

@cryptnotiq test notification system.

ghost commented 5 years ago

Tested @cryptnotiq

pacamara commented 5 years ago

@kyledewy @cryptnotiq @AspacehUK PR-4 and staging updated!

ghost commented 5 years ago

How it works:

Dropzone lets you create and send airdrops to multiple Ethereum addresses.

  1. Enable MetaMask
  2. Specify amount and addresses of the recipients.
  3. Confirm via MetaMask

Please note: although live, this dApp is still under development

ghost commented 5 years ago

Text for the 'How it works' screen

pacamara commented 5 years ago

Now the code is live on dropzone.mybit.io, will shutdown the staging instance.