Coder Social home page Coder Social logo

stablecoin.services's Introduction

About stablecoin.services

Today, we are introducing stablecoin.services, which allows for common Dai and Chai operations to be performed gas-free, at your convenience. This promotes Dai and Chai to first class tokens in the Ethereum network, allowing users to transact in these currencies without ever holding any Ether.

At launch, the following operations are supported:

  • Dai and Chai transfers,
  • Dai -> Eth and Chai -> Eth uniswap trades,
  • Dai <-> Chai conversions.

Head over to stablecoin.services to give it a spin. Alfred will be there to assist you.

image of butler

A relaying api is provided at api.stablecoin.services, which can be integrated into other dapps interested in offering gas-free conveniences to their users.

How does it work?

To initiate an action, the user signs a message specifying the details of the operation to be performed, and authorizes a relayer to process the transaction on their behalf. As the relayer submits the message to the blockchain, the operation is processed and the fee is delivered to the relayer to reimburse their gas costs.

At the heart of this process sits a smart contract called the Dai Automated Clearing House, or dach, for short. The first time you use stablecoin.services you will be asked to sign a message which permits this contract to operate on your behalf. You should study this contract carefully as it determines the terms of engagement between you and the relaying service. It specifies a set of message types, one for each action offered by stablecoin.services, and corresponding functions which executes the operation specified by each message.

This is all made possible by the permit function in the Dai and Chai contracts, which allows for approvals to be done by signed messages, instead of transactions relying on msg.sender. We hope that stablecoin.services serves as an example of the power and extensibility of the permit construction, and encourage future token designers to adopt a similar pattern.

The processing fee suggested by the front end is calculated according to the following formula:

operation_fee = 1.1 * gas_per_operation * fast_gas_price * eth_price_in_dai (or chai),

where fast_gas_price is provided by Gas Station Network.

What are the risks?

The dach contract has not yet undergone an audit. It is a fairly small and straightforward contract written and reviewed by experienced smart contract developers, but as with all smart contracts, you should make your own risk assessment before engaging.

Assuming the contract works as intended, neither the relayer or the dach contract holds custody over any user assets. They are simply granted the permission to execute the actions as specified by the signed messages by the user, and the worst they can do is to withhold from processing an operation, only to submit it when the user gives up. To mitigate against this, messages are equipped with an expiration date after which they can no longer be processed. The time to live for messages signed using stablecoin.services is 10 minutes. Messages are also equipped with a nonce for replay protection and to enable overwriting of stale messages.

Resources

The code for the dach contract can be found at github.com/dapphub/ds-dach, or in the etherscan live deployment

The code for the stablecoin.services front end is hosted at github.com/MrChico/stablecoin.services.

Both distributed under the AGPL license.

Pixel Art by Abbey Titcomb

Documentation of the relaying api is provided at api.stablecoin.services

Martin Lundfall, Andrew Cassetti, Lev Livnev

stablecoin.services's People

Contributors

amcassetti avatar mrchico avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

stablecoin.services's Issues

Server API + documentaiton

I would like to expose the basic features provided by the server as a proper API.

There will need to be some effort into making this a "proper" API, or at least one that doesn't completely suck. And documentation.

Would be nice to have a discussion with @reverendus on this

Gas and fee handling

Without employing any complicated resubmitting functionality + nonce handling + gas calculations, the fee users need to pay for a given cheque should only be fixed, and given by a server side calculation. The price will be delivered to the front end by a call to an api function, getPermitAndChequeFee() or getChequeFee() (depending on whether the user has already permitted the dach or not). The result of this call would be inserted into the fee box in the front end.

Similarly, for swapToEth.

DSR integration?

It might be nice to incorporate a simple way for dai holders to put their dai into the pot to accumulate interest, still without requiring them to hold eth.

This is definitely possible, but it remains to be seen how much complexity it will add, so it's mainly a question about scope.

Provide alternative for fast_gas_price - for slower but cheaper transactions (aka: lowering processing fee)

Currently, the processing fee suggested by the front end is calculated according to the following formula:
operation_fee = 1.1 * gas_per_operation * fast_gas_price * eth_price_in_dai (or chai),
where fast_gas_price is provided by Gas Station Network.

At the time of writing this comes down to a $9.9 tx fee for a simple DAI transfer (at ~145 Gwei for fast_gast_price). For many applications, this is prohibitively expensive.
image

Can an alternative be provided for users that do not require fast transactions?
e.g. using the average_gas_price from the Gas Station Network?

image
(Source)

Potential issue: The "time to live" for messages signed using stablecoin.services is currently 10 minutes. This might need to be increased, to accomodate for slower confirmation.

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.