GithubHelp home page GithubHelp logo

locskeleton / erc20-megawallet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cipherzzz/erc20-megawallet

0.0 1.0 0.0 47 KB

An Smart Contract 'Wallet' for managing ERC20 tokens

JavaScript 100.00%

erc20-megawallet's Introduction

ERC20 Megawallet

This is an example of an ERC20 'Wallet' that can generate deposit addresses and manage tokens sent to those addresses. It is ultimately a smart contract that manages other smart contracts but we can logically think of it as a wallet.

The Problem

I created this as a means to manage ERC20 deposits from multiple external addresses and specifically to pay the gas from the owner account. I was running into an issue where I could create an account and allow users to deposit their ERC20 tokens into it, BUT the created deposit account would have to have Eth in it to transfer the tokens out.

The Solution

By deploying the Megawallet and generating smart contract deposit addresses, we are able to own the funds in the smart contracts and pay for the transfers out of the owner account.

Install and Run

Install Ganache as a local ethereum chain

Install the project and dependencies

git clone megawallet && cd megawallet
npm install

Copy the .env.example to a new file named .env

Add the mnemonic phrase from the ganache app to your .env

Add a public and private key from any ganache account other than the first to your .env file(I used the 6th one down). Just click on the key icon and you will see the public and private keys.

Compile, Migrate, and Test

truffle compile
truffle migrate
truffle test

Summary

Take a look at the megawallet.spec.js file. It will inform you of what is happening with our test. It is worth noting that rather that our owner account[0] owns the megawallet and the associated deposit accounts.

erc20-megawallet's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.