Skip to content

encoderafat/disperse

Repository files navigation

Disperse DAPP

Disperse DAPP is a batching protocol for both native currency and ERC20/XRC20 tokens that can help reduce gas cost for multiple transfers by batching them in a single block.

DAPP is live at https://awesome-torvalds-4365b5.netlify.app/

Contract Address : 0x3744c2e13e51A9305D2E9381f5E5D0BBd1a733a4 on IOTEX Testnet

Installation and Tests

Backend (Truffle)

Use .secret file to store mnemonic or make suitable changes to truffle-config.js

npm install truffle-hdwallet-provider @openzeppelin/contracts@2.5.0 To install dependencies

truffle test to run tests. (You may have to install ganache-cli)

You should get a screen similar to this if the tests are successful.

truffle migrate --reset --network testnet to migrate to the iotex testnet.

Frontend (create-react-app)

yarn install

yarn start

Documentation

This DAPP is based entirely on Artem K's disperse app on ethereum. (PDF Link)

My contract is compatible with solidity 0.5.x and is available here.

To batch together native currency.

function disperseEther(address payable[] calldata recipients, uint256[] calldata values) external payable

recipients is an array of addresses and the values is the array of amount that is being send to each of the addresses respectively.

To batch together ERC20/XRC20 tokens.

function disperseToken(address tokenAddress, address payable[] calldata recipients, uint256[] calldata values) external

tokenAddress is the contract address of the ERC20 contract. The other values are same as above.

There is also a simplified and unoptimized version of disperseToken that we won't be using for our dapp.

function disperseTokenSimple(address tokenAddress, address payable[] calldata recipients, uint256[] calldata values) external

Usage

Please click on images to enlarge.

Website

This is a fairly basic GUI. It isn't production ready yet but I intend to iron out all the deficiencies, add error checks and then launch it on the IOTEX mainnet if the original disperse app is not going to be ported to iotex any time soon.

  1. Metamask wallet is required.

  1. Home Page of the App is loaded once metamask is connected and you shift to IOTEX testnet.

  1. Transfer Currency (IOTX-T) from the user account to two other accounts.

  1. View the transaction on iotexscan.io

Disperse Contract on IOTEXSCAN.IO

  1. Token dispersal is a two part process as you have to approve the contract to spend your tokens on your behalf. For this demo I deployed a token on the IOTEX testnet with the contract address [0xdE84062Ba55ed6671153BcB374477Bbf8BFfb764]

  1. Disperse tokens.

  1. View the Transaction on iotexscan.io

Transaction on IOTEXSCAN.IO

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published