ERC: Token Changer #228

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

Comments

Projects
None yet
4 participants
@obb

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

This comment has been minimized.

Show comment
Hide comment
@chrisfranko

chrisfranko Jun 13, 2017

Pretty neat.

Pretty neat.

@Arachnid

This comment has been minimized.

Show comment
Hide comment
@Arachnid

Arachnid Jun 13, 2017

Collaborator

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

Collaborator

Arachnid commented Jun 13, 2017

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

@k06a

This comment has been minimized.

Show comment
Hide comment
@k06a

k06a May 20, 2018

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

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 Jun 2, 2018

@k06a

This comment has been minimized.

Show comment
Hide comment
@k06a

k06a Jun 2, 2018

@obb why closed?

k06a commented Jun 2, 2018

@obb why closed?

@k06a k06a referenced this issue in Uniswap/contracts-vyper Jun 14, 2018

Open

ERC228 support? #1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment