Home Page
A-Token
GMT:

P2P Token Exchange.

Smart Contract Address:

0x287D4D393fe77CAF1faC1717CfDEA6300B302c1B   

The Problem:

Less trust between people wishing to exchange ERC20 tokens between themselves.

Sometimes you even do not know the second party for such an exchange.

The solution:

Our Smart Contract does the "Atomic Swap" transaction for both sides.

Our Smart Contract enables the creation of a new exchange to be done with a known or unknown second party.

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:
newExchange
(address smart1, uint256 amount1, address two2, address smart2, uint256 amount2) – Where a new transaction is built.
getStruct
(uint _Id) Which allow to view all data of an exchange.
cancelExchange
(uint exchangeId) – 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.
doExchange
(uint exchangeId) – Where the second part initiates the exchange.

Deeper look into activating the functions using MyEtherWallet.com:

newExchange
(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. Smart1 - 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. 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. Smart2 – the address of the other Smart Contract that manages the tokens to be exchanged. Use of 0x0000000000000000000000000000000000000000 means you wish to exchange those tokens with Ether.
    5. Amount2 – The token amount to be exchanged or the Ether amount.
  7. Do remember to give the right Ether 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. You must Approve the use of this Smart Contract on the ERC20 tokens to be exchanged smart contract, otherwise the exchange cannot be done.

getStruct(exchangId) 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 in Etherscan.io to learn about transactions done via this Smart Contract.

cancelExchange(exchangeId) 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(exchangeId) function:

If the second party was set in the NewExchange then only that second party can doExchange this exchange. If the second party was not set, anybody can do the exchange. This function has 206000000 WEI fee. If Ether is needed, do add it to the Ether value transferred.

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

This is the first Smart Contract we deployed (at 2 August 2018) .
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