Less trust between people wishing to exchange ERC20 tokens between themselves.
Sometimes you even do not know the second party for such an exchange.
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.
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 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.
(uint exchangeId) – Where the second part initiates the exchange.
Choose the newExchange function from the functions menu.
The newExchange function has 5 arguments:
Smart1 - address of the Smart Contract managing the ERC20 that you wish to exchange. Using 0x0000000000000000000000000000000000000000 means that you wish to use Ether.
Amount1 – the token amount or the Ether amount.
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.
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.
Amount2 – The token amount to be exchanged or the Ether amount.
Do remember to give the right Ether value for the function. The fee is 206000000 WEI.
Determine the proper Gas and Gas value.
Submit the transaction.
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.
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.
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.
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.