Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: Fundaria on July 07, 2017, 08:23:58 AM



Title: Escrow exhange contract for ethereum tokens
Post by: Fundaria on July 07, 2017, 08:23:58 AM
One guy asked in Reddit about simple ethereum contract which can serve as escrow exchange for any tokens. I accepted the challange and created it in little more then in one hour.
Now everyone can use this contract to safelly escrowed sell their tokens to anyone.
Here are simple steps to sell tokens:
0) Be sure that's all OK reading source code of contract here https://etherscan.io/address/0x03a6290b5c0875313422ee003bd323979c8d1ac2#code (http://here https://etherscan.io/address/0x03a6290b5c0875313422ee003bd323979c8d1ac2#code)
1) Run function approve(address _spender, uint256 _value) in the contract with your tokens setting maximum value of tokens for sale to EscrowExhange contract address
2) Run function setTokenForSale(uint course, address tokenContractAddress) in the contract 0x03a6290b5c0875313422ee003bd323979c8d1ac2 , setting the course in wei and the address of contract with your tokens. Course means the number of wei for 1 token. For example if you estimate cost of tokens 100 tokens for 1 ETHER course will be 10000000000000000 (16 zeroes) wei.
3) Send information to token buyer about your deal with your address under which your tokens are holded in tokens contract (this address is necessary information but buyer also need to know the mentioned course of course). Or post such information somewhere if you want anyone will see that you declare your tokens for sale.
4) Buyer should simply execute function buyToken(address sellerAddress) of the EscrowExhange contract mentioning your address (that exact address under which your tokens are mapped in tokens contract) abd sending ETH for desired tokens which will be transfered to token seller.
Voila!
I'm not sure if this solution is original and appeared earlier, but I did not see any relevant search result in this branch of the forum for keywords "escrow exhange token contract".