ERC-1175: Wallet & shop standard for all tokens (erc20)


Metadata
Status: StagnantStandards Track: ERCCreated: 2018-06-21
Authors
Jet Lim (@Nitro888)
Requires

All tokens go to heaven

Simple Summary


Make wallets and shops created from certified contracts make erc20 tokens easy to use for commerce.

wallet

Abstract


The mutual trust between the wallet and the shop created by the authenticated contract allows you to pay for and purchase items at a simple process.

Motivation


New standards with improvements have been released, but the majority of tokens currently being developed are erc20 tokens. So I felt I needed a proposal to use old tokens in commerce. To use various erc20 tokens for trading, you need a custom contract. However, a single wallet with a variety of tokens, and a mutually trusted store, can make transactions that are simple and efficient. The erc20 token is traded through two calls, approve (address _spender, uint256 _value) and transferFrom (address _from, address _to, uint256 _value), but when using the wallet contract, paySafe (address _shop, uint256 _item)will be traded only in one call. And if you only reuse the store interface, you can also trade using payUnsafe (address _shop, uint256 _item).

Specification


workflow

WalletCenter


Methods

createWallet

Create wallet contract and add to list. Returns the address of new wallet.


isWallet

Returns true or false value for test this address is a created by createWallet.


createShop

Create Shop contract and add to list. Returns the address of new Shop with erc20 token address.


isShop

Returns true or false value for test this address is a created by createWallet.


Events

Wallet

Search for my wallet.


Shop

Search for my shop.


Wallet


Wallet must be created by wallet center.

Methods

balanceOf

Returns the account balance of Wallet.


withdrawal

withdrawal _value amount of _erc20 token to _owner.


paySafe

Pay for safe shop (created by contract) item with item index _item.


payUnsafe

Pay for unsafe shop (did not created by contract) item with item index _item.


payCancel

Cancel pay and refund. (only weekly model)


refund

Refund from shop with item index _item.


Events

Pay


Refund


Shop


Shop is created by wallet center or not. but Shop that created by wallet center is called safe shop.

Methods

balanceOf

Returns the account balance of Shop.


withdrawal

withdrawal _value amount of _erc20 token to _owner.


pay

Pay from buyer with item index _item.


refund

refund token to _to.


resister

Listing item for sell.


update

Update item state for sell. (change item _price or add item _stock)


price

Get token address and price from buyer with item index _item.


canBuy

_who can Buy _item.


isBuyer

_who is buyer of _item.


info

Set shop information bytes.


upVote

Up vote for this shop.


dnVote

Down vote for this shop.


about

Get shop token, up vote and down vote.


infoItem

Set item information bytes.


upVoteItem

Up vote for this item.


dnVoteItem

Down vote for this item.


aboutItem

Get Item price, up vote and down vote.


Events

Pay


Refund


Item


Info


InfoItem


Implementation


Sample token contract address is 0x393dd70ce2ae7b30501aec94727968c517f90d52

WalletCenter contract address is 0x1fe0862a4a8287d6c23904d61f02507b5044ea31

WalletCenter create shop contract address is 0x59117730D02Ca3796121b7975796d479A5Fe54B0

WalletCenter create wallet contract address is 0x39da7111844df424e1d0a0226183533dd07bc5c6

Appendix



Copyright


Copyright and related rights waived via CC0.