To assist with this task, have a look at a related PR: https://github.com/geniusyield/dex-contracts-api/pull/88.