kleros / escrow-react

Kleros Escrow React Library
1 stars 1 forks source link

Support/logic for supporting ETH + ERC20 tokens #9

Open satello opened 3 years ago

satello commented 3 years ago

The component takes currency as an input but there is no logic to route it to the ERC20 contract instead of the normal arbitrable contract. Will need to get address from T2CR and throw an error if a token ticker is used that is not in the list. Alternatively you can have seller pass a contract address in addition to the ticker and bypass using the T2CR

epiqueras commented 3 years ago

Why is currency a prop instead of defaulting to ETH and having a prop token for custom addresses?

satello commented 3 years ago

You can do it this way. You need the ticker as well for display, but you can have token = {ticker, address}

epiqueras commented 3 years ago

You can get the ticker from the token contract.

satello commented 3 years ago

Not always. It is an optional field so I think it is better to have it passed. We also we need to be careful because you can't use any token -- it needs to be ERC20. So if someone uses the widget with a different token the buyers payment will be stuck in the contract. This was my original thinking when I planned to integrate the T2CR.

epiqueras commented 3 years ago

Ahh, ok.

So if someone uses the widget with a different token the buyers payment will be stuck in the contract.

How is that related to the ticker thing?

satello commented 3 years ago

It's related because its part of the decision to not use the T2CR. One option that I was planning on going with is to have them just pass the ticker and look up the contract address in the T2CR (and throw an error if a ticker passed doesn't have the ERC20 badge). The other option we have discussed here is to have the integrator pass the ticker and address

epiqueras commented 3 years ago

Can't multiple tokens have the same ticker?