ERC-2019: Fundable Token


Metadata
Status: StagnantStandards Track: ERCCreated: 2019-05-10
Authors
Fernando Paris (fer@io.builders), Julio Faura (julio@adhara.io), Daniel Lehrner (daniel@io.builders)
Requires

Simple Summary


An extension to the ERC-20 standard token that allows Token wallet owners to request a wallet to be funded, by calling the smart contract and attaching a fund instruction string.

Actors


Token Wallet Owners

The person or company who owns the wallet, and will order a token fund request into the wallet.

Token contract owner / agent

The entity, company responsible/owner of the token contract, and token issuing/minting. This actor is in charge of trying to fulfill all fund request(s), reading the fund instruction(s), and correlate the private payment details.

Orderer

An actor who is enabled to initiate funding orders on behalf of a token wallet owner.

Abstract


Token wallet owners (or approved addresses) can order tokenization requests through blockchain. This is done by calling the orderFund or orderFundFrom methods, which initiate the workflow for the token contract operator to either honor or reject the fund request. In this case, fund instructions are provided when submitting the request, which are used by the operator to determine the source of the funds to be debited in order to do fund the token wallet (through minting).

In general, it is not advisable to place explicit routing instructions for debiting funds on a verbatim basis on the blockchain, and it is advised to use a private communication alternatives, such as private channels, encrypted storage or similar, to do so (external to the blockchain ledger). Another (less desirable) possibility is to place these instructions on the instructions field in encrypted form.

Motivation


Nowadays most of the token issuing/funding request, based on any fiat based payment method need a previous centralized transaction, to be able to get the desired tokens issued on requester's wallet. In the aim of trying to bring all the needed steps into decentralization, exposing all the needed steps of token lifecycle and payment transactions, a funding request can allow wallet owner to initiate the funding request via blockchain. Key benefits:

  • Funding and payment traceability is enhanced bringing the initiation into the ledger. All payment stat s can be stored on chain.
  • Almost all money/token lifecycle is covered via a decentralized approach, complemented with private communications which is common use in the ecosystem.

Specification



Functions

authorizeFundOperator

Wallet owner, authorizes a given address to be fund orderer.

ParameterDescription
ordererThe address of the orderer.

revokeFundOperator

Wallet owner, revokes a given address to be fund orderer.

ParameterDescription
ordererThe address of the orderer.

orderFund

Creates a fund request, that will be processed by the token operator. The function must revert if the operation ID has been used before.

ParameterDescription
operationIdThe unique ID to identify the request
valueThe amount to be funded.
instructionA string including the payment instruction.

orderFundFrom

Creates a fund request, on behalf of a wallet owner, that will be processed by the token operator. The function must revert if the operation ID has been used before.

ParameterDescription
operationIdThe unique ID to identify the request
walletToFundThe wallet to be funded on behalf.
valueThe amount to be funded.
instructionA string including the payment instruction.

cancelFund

Cancels a funding request.

ParameterDescription
operationIdThe unique ID to identify the request that is going to be cancelled. This can only be done by token holder, or the fund initiator.

processFund

Marks a funding request as on process. After the status is on process, order cannot be cancelled.

ParameterDescription
operationIdThe unique ID to identify the request is in process.

executeFund

Issues the amount of tokens and marks a funding request as executed.

ParameterDescription
operationIdThe unique ID to identify the request that has been executed.

rejectFund

Rejects a given operation with a reason.

ParameterDescription
operationIdThe unique ID to identify the request that has been executed.
reasonThe specific reason that explains why the fund request was rejected. EIP 1066 codes can be used

isFundOperatorFor

Checks that given player is allowed to order fund requests, for a given wallet.

ParameterDescription
walletToFundThe wallet to be funded, and checked for approval permission.
ordererThe address of the orderer, to be checked for approval permission.

retrieveFundData

Retrieves all the fund request data. Only operator, tokenHolder, and orderer can get the given operation data.

ParameterDescription
operationIdThe unique ID to identify the fund order.

Events

FundOrdered

Emitted when an token wallet owner orders a funding request.

ParameterDescription
operationIdThe unique ID to identify the request
walletToFundThe wallet that the player is allowed to start funding requests
valueThe amount to be funded.
instructionA string including the payment instruction.

FundInProcess

Emitted when an operator starts a funding request after validating the instruction, and the operation is marked as in process.

ParameterDescription
ordererThe address of the fund request orderer.
operationIdThe unique ID to identify the fund.

FundExecuted

Emitted when an operator has executed a funding request.

ParameterDescription
ordererThe address of the fund request orderer.
operationIdThe unique ID to identify the fund.

FundRejected

Emitted when an operator has rejected a funding request.

ParameterDescription
ordererThe address of the fund request orderer.
operationIdThe unique ID to identify the fund.
reasonThe specific reason that explains why the fund request was rejected. EIP 1066 codes can be used

FundCancelled

Emitted when a token holder, orderer, has cancelled a funding request. This can only be done if the operator hasn't put the funding order in process.

ParameterDescription
ordererThe address of the fund request orderer.
operationIdThe unique ID to identify the fund.

FundOperatorAuthorized

Emitted when a given player, operator, company or a given persona, has been approved to start fund request for a given token holder.

ParameterDescription
walletToFundThe wallet that the player is allowed to start funding requests
ordererThe address that allows the player to start requests.

FundOperatorRevoked

Emitted when a given player has been revoked initiate funding requests.

ParameterDescription
walletToFundThe wallet that the player is allowed to start funding requests
ordererThe address that allows the player to start requests.

Rationale


This standards provides a functionality to allow token holders to start funding requests in a decentralized way.

It's important to highlight that the token operator, need to process all funding request, updating the fund status based on the linked payment that will be done.

Funding instruction format is open. ISO payment standard like is a good start point,

The operationId is a string and not something more gas efficient to allow easy traceability of the hold and allow human readable ids. It is up to the implementer if the string should be stored on-chain or only its hash, as it is enough to identify a hold.

The operationId is a competitive resource. It is recommended, but not required, that the hold issuers used a unique prefix to avoid collisions.

Backwards Compatibility


This EIP is fully backwards compatible as its implementation extends the functionality of ERC-20.

Implementation


The GitHub repository IoBuilders/fundable-token contains the work in progress implementation.

Contributors


This proposal has been collaboratively implemented by adhara.io and io.builders.

Copyright


Copyright and related rights waived via CC0.