Giter VIP home page Giter VIP logo

ethtoerc20swap's Introduction

About

Implements an Ethereum contract which allows easy swapping of ETH for an ERC20 token.
An instance of it which allows swapping of ETH for ATS20 is deployed on the Ethereum mainnet at address 0xcc1320a48c76385e17e4e1c759ce8ea1d11687c2.

This facility was created for Ethereum community members who are looking for a convenient way to get hold of some ATS(20), e.g. in order to interact with the ARTIS blockchain.

The price of ATS20 is defined in the contract, configurable by the contract owner.
The currently configured price can be determined by reading the contract field erc20mUSDPrice. The unit is milli-USD per ATS20. At the time of writing, it's set to 85, meaning that 1 ATS20 will cost the ETH equivalent of 0.085 USD.
In order to determine the ETH equivalent of a given amount of USD, the contract uses the Medianizer contract of the MakerDAO system. That's the same on-chain ETH price feed which is used by the contracts governing the DAI stablecoin.

How to use

Simple: Send the amount of ETH you want to have swapped to the contract address 0xcc1320a48c76385e17e4e1c759ce8ea1d11687c2

The transaction will fail if the gas limit is set too low (< 60,000) or if the contract doesn't have enough ATS20 to execute the swap. Of course you won't lose your ETH in those cases.
You can check the current ATS20 balance of the contract here. In case it's less than what you want/need, feel free to contact us.
Once you got the ATS20, you may want to convert it to ATS on ARTIS Σ1. Read on in order to find out how to do that.

How to test

In order to test the contract, install the dependencies with npm i, then run npm run test.
This will spawn a test blockchain in the background and run the tests in the test directory.

ATS20 and ATS

ATS is the native token of the ARTIS blockchain.
ATS20 is an ERC20 token (more specifically, also a ERC677 token) which is a representation of ATS on the Ethereum mainnet.

ATS20 tokens can be created only by transferring ATS from ARTIS Σ1 to Ethereum via the bridge set up for that purpose.
That bridge consists of a set of contracts and of instances of an oracle application which are run by the so-called bridge authorities.
The authorities of the ATS<->ATS20 bridge are a subset of the authorities of the ARTIS Σ1 consensus protocol.

With the Dapp at https://bridge.artis.network (source) you can convert ATS20 on Ethereum to ATS on ARTIS Σ1 or the other way round.
In order to choose the direction, just connect your Metamask to the network from which the transfer starts.
E.g. in order to convert ATS20 to ATS, connect your Metamask to Ethereum. Reload the Dapp and you should have your Ethereum ATS20 balance on the left and the ARTIS Σ1 balance on the right, with the option to convert ATS20 to ATS.
If you connect your Metamask to ARTIS Σ1 and then reload the Dapp, it should be the other way round.

At the time of writing, the price of 1 ATS20 is set to the USD equivalent of 0.073 EUR (background).

Contact

For further questions, you can contact us at https://gitter.im/lab10-collective/Lobby

ethtoerc20swap's People

Contributors

d10r avatar

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.