mimo protocol
Search…
mimo protocol
English 1.1
Welcome to mimo!
The Formulas
Cross-Chain Trading
Analytics
FAQ
Listing Token on Mimo V2
mimo V2
mimo V2
Get Started
Smart Contracts
SDK
FAQ (V2)
mimo V1
Smart Contract
Automator
API
Powered By
GitBook
Automator
mimo automator: automate swap for advanced trader.
What you need?
You need the following tools or knowledge for this page
1.
ioctl - command line tool for IoTeX blockchain. a detailed instruction is
here
.
2.
bash - you need to have basic knowledge about bash functions
The recommended environment of running the automator is on macOS or Linux. On Windows, the best way to use it is WSL (
windows subsystem for linux
).
Enjoy the lightning fast trading experience provided by mimo on IoTeX network, now with automator!
Basic Functions
function to convert a timestamp to 32 bytes hex
1
function deadline() {
2
ts=`date +"%s"`
3
printf "%064x\n" `expr $ts + 60`
4
}
Copied!
function to convert a decimal number to 32 bytes hex
1
function decimal2hex() {
2
echo "ibase=A;obase=16;$1" | bc | xargs -0 -I h printf "%64s" h | sed "s/ /0/g"
3
}
Copied!
Construct
ioctl
Commands
Add liquidity
1
function addLiquidity() {
2
exchange=$1
3
min_liquidity=`decimal2hex $2`
4
max_tokens=`decimal2hex $3`
5
iotx_amount=$4
6
dl=`deadline`
7
ioctl contract invoke bytecode $exchange 422f1043${min_liquidity}${max_tokens}${dl}
8
}
Copied!
Remove liquidity
1
function removeLiquidity() {
2
exchange=$1
3
amount=`decimal2hex $2`
4
min_iotx=`decimal2hex $3`
5
min_tokens=`decimal2hex $4`
6
dl=`deadline`
7
ioctl contract invoke bytecode $exchange f88bf15a${amount}${min_iotx}${min_tokens}${dl}
8
}
Copied!
Get token to IOTX input price
1
function getTokenToIotxInputPrice() {
2
exchange=$1
3
amount=`decimal2hex $2`
4
ioctl action read $exchange d458a2d1${amount}
5
}
Copied!
Get IOTX to token input price
1
function getIotxToTokenInputPrice() {
2
exchange=$1
3
amount=`decimal2hex $2`
4
ioctl action read $exchange a46f9389${amount}
5
}
Copied!
Swap token to IOTX
1
function tokenToIotxSwapInput() {
2
exchange=$1
3
token_sold=`decimal2hex $2`
4
min_iotx=`decimal2hex $3`
5
dl=`deadline`
6
ioctl contract invoke bytecode $exchange 10dc202f${token_sold}${min_iotx}${dl}
7
}
Copied!
Swap IOTX to token
1
function iotxToTokenSwapInput() {
2
exchange=$1
3
iotx_sold=`decimal2hex $2`
4
min_token=`decimal2hex $3`
5
dl=`deadline`
6
ioctl contract invoke bytecode $exchange eecd096a${iotx_sold}${min_token}${dl}
7
}
Copied!
mimo V1 - Previous
Smart Contract
Next - mimo V1
API
Last modified
1yr ago
Copy link
Contents
What you need?
Basic Functions
function to convert a timestamp to 32 bytes hex
function to convert a decimal number to 32 bytes hex
Construct ioctl Commands
Add liquidity
Remove liquidity
Get token to IOTX input price
Get IOTX to token input price
Swap token to IOTX
Swap IOTX to token