I'm currently working on a new decentralised derivatives exchange and I'm considering using 0x protocol to perform swaps. In order to create market orders on chain I'm following this example here.

The example works for me however I would like to be able to access the swapCallData parameters from my smart contract as I'd like to do some validations before using it.

Is there a way to extract each field from swapCallData in js or solidity ? Is there a reference somewhere on the structure and content of this data, and is it guaranteed to always follow the same structure ?

1 Answer 1


The swap call data is an ever changing encoding so having this hardcoded in a smart contract will ultimately break.

The reason behind this is, over time, we optimize the call data to perform cheaper swaps for the user.

You could use and update the IZeroEx artifact to read this in javascript.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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