ioCash team, in collaboration with Adhara, have created the ERC 2020, EM-Token Standard that extends the ERC-20 token standard and 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 these concepts in its smart contracts. The next paragraphs will explain how you can use some of these functionalities by interacting with the smart contracts.
ioCash smart contracts are built based on the EM-Token standard. All ioCash smart contracts, except the cross ledger one, inherit from one master contract that we have called the EM-Token smart contract. Therefore, you can access all the available functionalities (holds, transfers, two step transfers etc.) by making calls against it. To make cross ledger transfers your have to use a different contract -The Cross Ledger Link (CLL)-.
To interact with the Em-Token you can use the following abstract contract from our GitHub repository. Our Github also contains a couple of very simple smart contract examples that showcase the interaction with the EM-Token. To use the Cross Ledger Link you can see its abstract in Github.
You can also check the demo web app that we have created to interact with the EM-Token. You could use it to get familiar with the creation of Dapps using the EM-Token and to build on top of it some extra functionalities with the aim of doing a simple and fast PoC or a demo of your use case.
Cross Ledger Link:
Cross Ledger Link:
Cross Ledger Link:
ioCash smart contracts offer the following features:
ioCash is fully compliant with the ERC-20 standard which is used for transfers. The following functions are available:
Send tokens to another address.
Send tokens on behalf of somebody else.
Allow another address to send on your behalf.
Tells you how much somebody can send on somebody else's behalf.
Tells you how many tokens an address has.
Tells you total amount of all tokens combined.
Tells you how many decimals after the coma can be used when transferring tokens.
Tells you the individual symbol of a token.
Tells you the individual name of a token.
For more details please see the ERC-20 standard.
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 no transfer is carried out and the amount is available again for the payer. It is also possible to add an expiration date to holds. If ther hold has not yet been executed or released and the expiration date is achieved, the held quantity is realesed on the sender's account. The expiration of a hold is optional, it can also be perpetual (no expiration).
The following functions are offered:
Creates a new hold.
Creates a new hold passing the expiration date in seconds instead of the time until it expires.
Creates a new hold on behalf of another account.
Creates a new hold on behalf of another account passing the expiration date in seconds instead of the time until it expires.
Transfers all or a part of the tokens which were specified when creating the hold. The remaining part of the hold that is not sent is released on the sender's account
Transfers a part of the tokens which were specified when creating the hold. The remaining part that is not sent is kept on hold for a future execution or release.
Does not make a transfer and makes the held tokens available again to the payer.
Changes the expiration time.
Changes the expiration time passing the expiration date in seconds instead of the time until it expires.
Returns the details of a given hold.
Tells you how many tokens of an address are held.
Tells you how many tokens including the held tokens an address has.
Tells you total amount of all held tokens combined.
Authorizes an account to create holds on behalf of the sender.
Revokes the permission to create holds on behalf of the sender.
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:
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.
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.
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.
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:
Creates a request for a transfer.
Transfers the token which were specified when requesting the transfer.
Revokes the transfer after it has expired.
The notary can revoke the hold at any time.
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.
Cross ledger transfers enable the transfer tokens between different networks. There are several steps in a cross ledger transfer that transits it to different statuses. After a user orders it, status
ORDERED, the money is put into escrow in the origin network. Then, the platform checks that the operation fulfills all the needed requirements, confirming it in the origin network, status
ACCEPETED, and in the destination network, status
ACKNOWLEDGED. Finally, it is executed in the destination nework, status
TRANSFER_IN_EXECUTED and origin network, status
Hash-locks and suspense accounts are used to ensure the correct order in the operation and the needed security measures. If you want to know more about the flow and functioning of our cross ledger implementation, check this post
To make a cross ledger you have to use the Cross Ledger Link smart contract. The following functions are offered:
Creates a request for a cross ledger transfer.
Retrieves the information about a cross ledger transfer.
For size reasons, we have codified some revert reasons of our smart contracts. Although the movements already have the translation made and the error text is displayed, if you are directly working with our smart contracts you will get the plain error codes. You can use the table below for the needed translation.
|Error code||Error reason|
|0x10||Operation only allowed for owner/bank|
|0x11||Only available for migrator|
|0x12||Only available for operators|
|0x13||Token can not trade partial amounts|
|0x14||Token is locked|
|0x15||Token not whitelisted|
|0x16||Only available if one-step-transfers are activated|
|0x17||Sender is not allowed to send tokens|
|0x18||Receiver is not allowed to receive tokens|
|0x19||Sender is not allowed to mint tokens|
|0x1A||Sender is not allowed to burn tokens|
|0x1B||The sender is unsubscribed|
|0x1C||The receiver is unsubscribed|
|0x1D||Action not allowed to any user|
|0x1E||Only available for currency registry operator|
|0x1F||Only available for cross ledger operator|
|0x20||Target cannot be zero address|
|0x21||Compliance registry cannot be zero address|
|0x22||Registry cannot be zero address|
|0x23||The address is not permissioned in the token|
|0x24||Origin cannot be zero address|
|0x32||Token is already locked|
|0x33||Cross ledger transfer operation Id already exists|
|0x34||Status of cross ledger transfer should be "Ordered"|
|0x35||Status of cross ledger transfer should be "Acknowledged"|
|0x36||Status of cross ledger transfer should be "Accepted"|
|0x37||Hold operation Id already exists|
|0x50||Amount should be greater than zero|
|0x51||Not enough balance|
|0x52||Currency is not active|
|0x53||Currency is already active|
|0x54||Currency token is not equal to source token|
|0x55||Suspense account already exists|
|0x56||Suspense account does not exist|
|0x57||Token operator already exists|
|0x58||Token operator does not exist|
|0x59||Suspense account cannot be deactivated because it has positive balance|
|0x5A||Hashlock and secret do not match|
|0x5B||Cross ledger operator already exists|
|0x5C||Cross ledger operator does not exist|
|0x5D||Chain already active|
|0x5E||Chain is not active|