Home Page

P2P Token Exchange.

Smart Contract Address:


The Problem:

Less trust between people wishing to exchange ERC20 tokens between them. Sometimes you do not know the second party for an exchange.

The solution:

Our Smart Contract does the transaction for both sides. Our Smart Contract enables the creation of one side exchange to be done with the first and second party. Thus the transaction would be fully done or not done at all. A small fee (206000000 WEI) is payable for the usage of each function of this Smart Contract. This fee is transferred to the A-Token Smart Contract to increase its' Reserve.

How To:

This Smart Contract has 4 functions:
(address smart1, uint256 amount1, address two2, address smart2, uint256 amount2) – Where a new transaction is built.
(uint _Id) Which allow to view all data of an exchange.
(uint exchanged) – Where both parties can cancel the exchange. If the deal was constructed with Ether, this Ether will be returned to the proper wallet. Do remember that Approve Function of ERC20 tokens can be canceled by using the "spender" address and the 0 amount.
(uint exchanged) – Where the second part initiates the exchange.

Deeper look into activating the functions using MyEtherWallet.com:

(address smart1, uint256 amount1, address two2, address smart2, uint256 amount2) function activation steps:
  1. Click on the Contracts tab of the site menu.
  2. Insert Contract address – 
  3. Insert the ABI – 
  4. Choose the newExchange function from the functions menu.
  5. Write.
  6. The newExchange function has 5 arguments:
    1. Address of the Smart Contract managing the ERC20 that you wish to exchange. Using 0x0000000000000000000000000000000000000000 means that you wish to use Ether.
    2. Amount1 – the token amount or the Ether amount.
    3. Address Two2 – the wallet address of the other peer. Using 0x1111111111111111111111111111111111111111 address means that you do not know the second party and whomever comes can do the deal.
    4. Address Smart2 – the address of the other Smart Contract manages the tokens to exchange. Use of 0x0000000000000000000000000000000000000000 means Ether.
    5. Amount2 – The token amount to be exchanged or the Ether amount.
  7. Do remember to give the right value for the function. The fee is 206000000 WEI.
  8. Determine the proper Gas and Gas value.
  9. Submit the transaction.
  10. Do remember, that you need to Approve the Smart Contract ability to transfer the tokens. So, you must Approve the Smart Contract otherwise the exchange will not be done.

getStruct function:

This function has no fee on it. You use this function to learn on the transaction that was built. You can also look on the Events section to learn about the transaction.

cancelExchange function:

Both parties can cancel an exchange. This function carry a 206000000 WEI fee. A canceled exchange cannot be done and a newExchange must be built.

doExchange function:

Only the second party can doExchange the exchange. This function has 206000000 WEI fee. If Ether is needed, do add it to the value transferred for the function activation.

All fees paid to the use of this Smart Contract serves the A-Token as reserve. Thus using this Smart Contract is beneficiary for A-Token holders.

This is the first Smart Contract we deployed.
We plan to build more Smart Contracts in order to support the A-Token economics.

Solidity and the ABI code

Email: Arik@AriksWorld.com to list your contribution