Coder Social home page Coder Social logo

sigwallet-erc20's Introduction

SigWallet

Everything is explained much more in depth here:
https://medium.com/@primozkocevar/forwarder-contract-for-ether-and-erc-20-tokens-e257a621889d

About

Wallet contracts for sending multiple ERC20 and ETH tokens at the same time to one wallet and setting off events when this happens. This project is developed with help of an already existing repository https://github.com/BitGo/eth-multisig-v2

How it works?

Wallet.sol includes a simple wallet contract that uses a Forwarder.sol contract to forward ERC20 tokens to a parent address that is specified when the Forwarder is created. Important is that every Forwarder has its own unique ethereum address and thus a common Wallet contract can receive funds from multiple forwarders. However forwarding is different for ERC20 tokens and Ether. Ether gets forwarded from a Forwarder contract to the main Wallet contract automatically and at this time emits an Ethereum event containing the information needed to record this transaction. ERC20 tokens can not be forwarded under the ERC20 standard and thus an flushTokens() function needs to be called for each Forwarder if it has received a certain amount of tokens. When this is called an event is again emited.

Where to use?

This mechanism can be used everywhere you need to receive tokens and Ether from different users to a single address and additionaly note which funds have been sent by a certain user. Thus you can give a deployed Forwarder contract to each user and record events when users send funds to this Forwarder that forwards them to the main Wallet contract that is usually controlled by your platform (exchange, cryptomarketplace, a crypto platform...)

MultiSig Withdraw?

Doing a withdraw with multiple signatures can be more secure as the withdraw from the main Wallet contract needs signatures from multiple keys that can be owned by different entities. Smart contracts and tests for this use case can be found: https://github.com/BitGo/eth-multisig-v2

Future

Writing Tests in Truffle for used contracts is still needed so that their functionality can be better presented.

This repository deals with Ether and ERC20 tokens. If your tokens are using different implementation standards (ERC-223, ERC-721) than forwarding is maybe done differently and you should look elsewhere for a more efficient solution.

With the development of Ethereum 2-layer solutions like Plasma (specifically Plasma Cash) the mechanisms implemented in this repository will probably become unefficient as needed solutions will be provided by Plasma (as it is envisioned now in October of 2018).

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.