Use Contracts to Trade on mimo.exchange

Raullen Chai
Oct 30, 2020

--

https://mimo.exchange/ is a decentralized protocol for asset-exchanging on IoTeX blockchain. This blog post is a 101 on how to trade on mimo.exchagne in a fully decentralized way.

Before start, I would strongly suggest you download and install ioctl— the command-line tool to interact with IoTeX blockchain — from https://docs.iotex.io/developer/ioctl/install.html and set the default account by ioctl config set defaultacc [your default account]. This makes the following operations much easier.

  1. The code looks as simple as above. Note that:
  • The io address of mimo’s vita exchange and vita token needs to be translated into 0x address using ioctl account ethaddr
  • buyvita() basically calls mimo’s iotxToTokenSwapInput to facilitate the trade with the given IOTX amount
  • Once the trade is done, remember to transfer the obtained VITA tokens to the caller, otherwise they will live in the contract forever

2. Let’s compile the contract with ioctl contract compile MyTrade --abi-out a.abi' which will also generate a local abi file which we will use later.

3. Once compiled, using ioctl contract deploy sol MyTrade to deploy the contract to IoTeX…

--

--