The preview UI
I'm not stable, but my DAI is. The aforementioned reason is a fantastic argument for being able to instantly swap your ETH into DAI and send it to a contact. Within Status.im, currently it's only possible to send your contacts assets that you already hold, but with the same number of transactions you could send them anything which has an ETH pair on Kyber.
Sending an asset pegged to fiat within a chat context is a use-case that is tried, tested and proved.
What it does
With weasel, you can send DAI by simply executing a single chat command within a Status chat. You don't need to have DAI already (just some ETH) and you don't need to execute more than one transaction. Simply type the number of DAI that you want to send and badda bing badda boom.
How I built it
My hackathon submission is comprised of two pieces:
- Tiny proxy contract in front of Kyber Network's proxy (proxy.sol)
- Status extension (extension.txt)
The function of each is described below.
Kyber network's own contracts currently allow you to purchase a token with ETH by directly sending ETH to the proxy contract. The proxy does not however allow us to forward the resulting token to an address that we do not control. For this reason, I have created a small contract which forwards the ETH and calls the correct function (
tradeWithHint) in the Kyber Proxy, with a single additional argument - the address of the token receiver.
The result is exactly the same as calling the Kyber Proxy directly, except the token is immedietely delivered to the recipient.
(Search proxy gif and you get this bad ass chica)
The extension allows you to execute the command
/send-dai with a single argument: the amount of DAI that you wish to send to your contact. Upon execution, this command then fetches the price of DAI (in ETH) from the Kyber Proxy, performs some arithmetic (surprisingly difficult in Status) to craft and send the transaction.
The extension could be a lot better, but there are some reasonably large limitations in the extensions API.
Challenges I ran into
Status extensions, my nemesis. It's not possible to make queries within Status extensions from event blocks, which is a large limitation. It meant that my extension is not quite as functional as I would like it to be.
The status-react repo also had a small bug which I fixed, so I had to use a custom build of Status to work on my solution.
Extensions are also a PITA to iterate on. Almost masochistic.
Accomplishments that I'm proud of
I built an extension (!!!!!!) and it's less than 10% hardcoded (!!).
What I learned
Kyber is sweet AF and very easy to interface with, it basically has all the functions you would want as a dev. I will be using it again for sure.
What's next for weasel
I plan to pester the Status team until they make it possible to realise the full vision of this extension.