Free TON DeFi (Ethereum)
@favoritefxHello!
We are more than happy to present you with the first DeFi prototype with primitive mechanics.
With it, you can transfer liquidity from ETH to TON, send swapped tokens to other addresses, withdraw it back to the ETH.
We have published all the solutions in the open-source and invite you to test it, contribute and help us develop.
🎁 We have also prepared modest rewards for testers: you will receive 1 TON for each swap.
⚠️ Disclaimer
We are not responsible for the performance of the prototype and the safety of funds. Everything can break at any time.
We will be grateful for any feedback and description of the problems.
Solution structure
1) Ethereum
The contract at first requests from the user some tokens so the contract can transfer them itself. After that, the user provides a FreeTON address to receive TON tokens and lock tokens on the contract. To reveal the locked tokens, the user should have the withdraw receipt (list of details: token, amount, receiver, receipt ID) signed by the owner key. The contract checks the signature, all the details, and then transfers tokens.
Link to Github
https://github.com/broxus/eth-gate-contracts/blob/master/ethereum-contracts/contracts/Gate.sol
Deployed SC
https://etherscan.io/address/0x7926b8570013117c625dafb4726b21da57ef2d5f
2) FreeTON
To say simple, the entire contract is a massive map in a format token ID -> user address -> balance, which it stores all users' balances for all token IDs. The contract mints new tokens when the user locks his ETH tokens.
Link to Github
https://github.com/broxus/eth-gate-contracts/blob/master/ton-contracts/contracts/Token.sol
Deployed SC
https://ton.live/accounts?section=details&id=0:08b697bafe589f5b14c6ce4f9cf4ff0a865a6f0c5a8371ea29ffe43643eb9fe4
3) The Wallet
To make testing more comfortable, we have added tokens support to the Crystal Wallet available for all major platforms.
Link to Github
https://github.com/broxus/wallet-desktop
Download links
https://l1.broxus.com/freeton/wallet
How to use it 👇
How to swap back tokens
1. Click Send
2. Input your ETH address and click Swap Back
3. Open swap back TX and click reveal
4. Load receipts
5. Choose needed receipt and click reveal
6. Confirm fee in metamask
How to swap tokens
1. Select token and click receive
2. Click swap
3. Input tokens amount that you want to swap
4. Click swap tokens
5. Confirm lock tx in Metamask