unidao / MarsDAO

MarsDAO source
3 stars 1 forks source link

Simple onboarding using ENS and Uniswap pool #5

Open leomorozovskii opened 4 years ago

leomorozovskii commented 4 years ago

The idea is to create a simple smart contract, that would exchange one asset for another using Uniswap pool whenever the contract recieves one of assets from user. Contract address is resolved using ENS name as the simplest user interface

pythonpete32 commented 4 years ago

Few questions about this

  1. What tokens are supported?
  2. Is the contract expected to push the tokens back? This is generally accepted as bad practice for smartcontracts
  3. What is the budget for this
leomorozovskii commented 4 years ago

1) Tokens supported should include ETH and DAI as the most liquid assets. Upon recieving any other asset the contract should revert transaction. 2 Uniswap pools should be utilized

2) What is your suggestion to execute the tokens swap? The idea was to revert any transaction that would transfer any token besides ETH or DAI or base token to the contract. So that each particular ENS smart-contract would only accept 3 tokens as a transfer function

3) What fo you think should be the budget for this idea? Simple smart-contract providing an ENS interface to interact with Uniswap pools

pythonpete32 commented 4 years ago

This is the way I would go. If it's only two pairs doing a push shouldn't be a problem.

So that each particular ENS smart-contract would only accept 3 tokens as a transfer function

What is the third token here?

On budget, I'm not sure. I guess it would take me ~20 hours to do but I wouldn't consider myself a professional solidity Dev.

In any case it's an interesting side project I wouldn't mind doing

leomorozovskii commented 4 years ago

So should be a trade between a custom token, for example a DAO token in Uniswap pool and ETH, DAI

1 Scenario: ETH is sent to a by a user, ETH is being traded with ETHtoERC20 swap on Uniswap pool, with predetermined parameters, otherwise reverted. User recieves a Custom DAO token. DAI is sent to , swapped with 2 transactions ERC20toETH and ETHtoERC20.

2 Scenario: Custom DAO token is sent to , swapped with ERC20toETH and then to DAI ETHtoERC20 with predetermined parameters. User recieves Dai back

That idea could be extended to have lots of ENS domains as the easiest swappers of any assets using Uniswap liquidity pools

pythonpete32 commented 4 years ago

Got it! This is a really cool idea. Especially like the use of ens

I would just make them separate contracts and compose them

Ie scenario 1(b) ERC20 -> ETH -> ERC20

The first transaction would call another subdomain

leomorozovskii commented 4 years ago

Yep, domains could call for subdomains and create composability feature. Domains should be short, easy to remember maybe under some common pattern name