Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERC: Token Changer #228

Closed
obb opened this issue Mar 13, 2017 · 4 comments
Closed

ERC: Token Changer #228

obb opened this issue Mar 13, 2017 · 4 comments

Comments

@obb
Copy link

obb commented Mar 13, 2017

Preamble

EIP: <to be assigned>
Title: Token Changer Standard
Authors: Eyal Hertzog & Yudi Levi (yudi|at|bancor.network)
Type: Informational
Category: ERC 
Status: Draft
Created: 2016-03-12
Requires: 20

Simple Summary

Standard functions for contracts offering token change services of standard ERC20 tokens.

Abstract

This ERC proposes a set of standard APIs for contracts providing change services between different ERC20 tokens.

The APIs can be used for:

  • Querying the list of tokens changeable through the contract
  • Querying the exchange rate between two changeable tokens, for a specific amount
  • Token change - the action of converting one changeable token to another through the contract.

Motivation

Those functions will allow dapps and wallets to utilize token-changing contracts across multiple interface/dapps. Token changing contracts function as automatic money-changers / market-markers, solving the ‘double coincidence of wants’ problem for token exchange.

Specification

Token Change

Methods

changeableTokenCount

function changeableTokenCount() public constant returns (uint16 count)

Gets the number of changeable tokens supported by the contract.

changeableToken

function changeableToken(uint16 _tokenIndex) public constant returns (address tokenAddress)

Given a changeable token index, gets the changeable token contract address.

getReturn

function getReturn(address _fromToken, address _toToken, uint256 _amount) public constant returns (uint256 amount)

Returns the currently expected return for changing a specific _amount of _fromToken to _toToken.

change

function change(address _fromToken, address _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256 amount)

Change _amount of _fromToken to _toToken.

The change will only take place if the returned amount of the _toToken is greater or equal to _minReturn.

NOTE: Sufficient allowance needs to be set for the _fromToken prior to executing the change function (except when the _fromToken is managed by the token change contract)

Events

Update

event Update();

Triggered when the list of changeable tokens is modified.

Change

event Change(address indexed _fromToken, address indexed _toToken, address indexed _changer, uint256 _amount, uint256 _return);

Triggered when a change between two tokens takes place.

Rationale

This is a simple standard which works well for different exchange rate calculation methods and fee structures.

The token changer functions may be integrated with an ERC20 functions, in which case, the contract may be listed as one of the changeable tokens.

Implementation

see https://github.com/bancorprotocol/contracts

Copyright

Copyright and related rights waived via CC0.

@chrisfranko
Copy link

Pretty neat.

@Arachnid
Copy link
Contributor

Looks good. This should be a PR rather than an issue, though.

@k06a
Copy link
Contributor

k06a commented May 20, 2018

Hi @obb! Do you have plans to create aggregated ERC228 Token Changer over Bancor network? Some kind of network facade.

@obb obb closed this as completed Jun 2, 2018
@k06a
Copy link
Contributor

k06a commented Jun 2, 2018

@obb why closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants