4

I looking for solution how to convert eth to dai with web3 api. something like https://kyber.network/swap/eth_knc (I can send eth to specyfic contract adress and I receive back DAI to the same address from I send eth.)

DAI contract address https://etherscan.io/address/0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359 Sorry for my english.

0

You will need some sort of oracle to determine the price of ETH (your exchange rate). Instead I would just use the official Maker library to do this. It will do exactly what you want - buying and selling MKR and Dai with built-in DEX integration.

https://github.com/makerdao/dai.js

0

The easiest way to do this is still through EtherDelta.

As far as I can tell Dai (and/or 0x) is building its own DEX that will become the official DEX for DAI, but the dai.js library and most of its documentation seem deliberately over-complex. There did used to be a library for trading DAI and ETH called OasisDex, but this was shut down due to some reason. Truthfully, it may have been due to incompetence -- every order on the site was fill-or-kill, which resulted in someone losing hundreds of thousands of dollars in DAI. I would not be surprised if the Maker DAO team is offloading its exchange integrations to the 0x team.

Off-topic: One thing that is pretty easy is accessing the DAI-USD price on-chain inside solidity. Visit the DAI chatroom for help using this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.