Working with ioCash


Contents



ioCash is a platform composed of a centralized API and smart contracts that reside on blockchain. While some operations start at the API-centric solution, others are directly executed against the blockchain in a decentralized way. In both cases, in all operations, it is required the intervention of the two parts of the platform and thus there is constant communication between them.

Cash-in operations (card cash-in and SEPA cash-in) are started in the centralized API since they are actions that are coming from exterior accounts and the change of balance is reflected first on the IBAN bank account. On the other hand, transfers between ioCash accounts are decentralized, users can directly trigger them against the blockchain. Of course, the operation will be as well reflected and verified by the banking institution connected to our API. Cash-outs are at the moment centralized operations but in the near future, it will also be possible to execute them directly against the smart contract.




Networks



IoCash is Ethereum network agnostic i.e. it can be used in any Ethereum based network, no matter if it is public, private or permissioned and what consensus protocol it is used.

For the moment, IoCash use cases are deployed on a permissioned network. Compared to the Ethereum main net, instead of PoW (proof of work), it uses POA ( Istanbul BFT ) consensus algorithm that does not require as much computational power and energy consumption. However, each client can decide in wich network to deploy their solution.





Em-Token and smart contracts



ioCash team, in collaboration with Adhara, is creating an extension of the ERC-20 token standard called EM-Token that adds extra functionalities with the aim to enable the issuance of regulated electronic money on blockchain networks and its practical usage in real financial applications.

These main functionalities are: compliance, holds, clearing, funding requests and payouts orders.

ioCash is already using some of these concepts in its smart contracts. The next paragraphs will explain these functionalities and how to use them by interacting with the smart contracts.

Interacting with EM-Token



In order to interact with the EM-Token smart contract the following Solidity contract can be used, which combines the transfer, hold and two step transfer functionalities.

The abstract EM-Token contract can be found in our GitHub repository.

Features


The EM-Token offers the following features:

Transfers


ioCash is fully compliant with the ERC-20 standard which is used for transfers. The following functions are available:

transfer
Send tokens to another address.

transferFrom
Send tokens on behalf of somebody else.

approve
Allow another address to send on your behalf.

allowance
Tells you how much somebody can send on somebody else's behalf.

balanceOf
Tells you how many tokens an address has.

totalSupply
Tells you total amount of all tokens combined.

decimals
Tells you how many decimals after the coma can be used when transferring tokens.

symbol
Tells you the individual symbol of a token.

name
Tells you the individual name of a token.



For more details please see the ERC-20 standard.


Holds


Holds guarantee a future transfer and make the held tokens unavailable for transfer in the meantime. Holds are similar to escrows because they are firm and lead to final settlement.
A hold specifies a payer, a target, an amount, a notary and an expiration time. When the hold is created, the specified token balance from the payer is put on hold. A held balance cannot be transferred until the hold is either executed or released. The hold can only be executed by the notary, which triggers the transfer of the tokens from the payer to the payee. The execution of a hold can be done with the full amount or a partial one. If only a partial hold is executed the remaining tokens are available again to the payer. If a hold is released, either by the notary or the target at any time, or by anyone after the expiration, no transfer is carried out and the amount is available again for the payer. The expiration of a hold is optional, it can also be perpetual.

The following functions are offered:

hold
Creates a new hold.

holdFrom
Creates a new hold on behalf of another account.

executeHold
Transfers all or a part of the tokens which were specified when creating the hold.

releaseHold
Does not make a transfer and makes the held tokens available again to the payer.

renewHold
Changes the expiration date.

retrieveHoldData
Returns the details of a given hold.

balanceOnHold
Tells you how many tokens of an address are held.

netBalanceOf
Tells you how many tokens including the held tokens an address has.

totalSupplyOnHold
Tells you total amount of all held tokens combined.

authorizeHoldOperator
Authorizes an account to create holds on behalf of the sender.

revokeHoldOperator
Revokes the permission to create holds on behalf of the sender.

isHoldOperatorFor
Returns if an account is authorized to create hold on behalf of another account.


The following ERC-20 functions behave differently than the standard if a hold is used:

balanceOf
The held balance of an account is deducted from the ERC-20 balance. In order to get all tokens assigned to an account the function virtualBalanceOf has to be used.

transfer
The implementation of ERC-20 has been changed in order to deduct the held balance from the ERC-20 balance. Any amount that is held can not be transferred.

transferFrom
The standard implementation of ERC-20 has been changed in order to deduct the held balance from the ERC-20 balance. Any amount that is held can not be transferred.


For more details please see our GitHub repository with the interface of the Holdable Token.



Two Step Transfers


The two step transfer (clearing) process turns the promise of a transfer into the actual movement of money from one account to another. It has the same properties as a hold, but the notary and expiration are set automatically by the ioCash platform. The amount which should be transferred is not deducted from the balance of the payer, but neither is it available for another transfer and therefore ensures, that the execution of the transfer will be successful when it is executed. Off-chain checks are executed to decide if the transfer can be executed or not.

The following functions are offered:

orderTransfer
Creates a request for a transfer.

releaseTransfer
Transfers the token which were specified when requesting the transfer.

revokeTransferByExpiration
Revokes the transfer after it has expired.

revokeTransferByNotary
The notary can revoke the hold at any time.

revokeTransferByTarget
The target can revoke the hold at any time.



For more details please see our GitHub repository with the interface of the TwoStep Transferable Token.