CenturionDEX

Universal Router Commands

Last modified:

Reference CenturionDEX Universal Router command encoding, supported v2 commands, and composition patterns for execute flows.

Transactions to UniversalRouter are expressed as a compact command stream. Each command maps to an operation module and reads one ABI-encoded item from inputs[i].

Execution Entry Points

Most integrations run through one of these execute overloads:

execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline)
execute(bytes calldata commands, bytes[] calldata inputs)

Both overloads process the same command stream. The deadline overload adds a timestamp guard.

UniversalRouter also exposes executeSigned(...), which sets signature context, validates the signature payload, and then routes into execute(commands, inputs).

Command Byte Encoding

Each command is 1 byte with this layout:

70 to 6
fcommand

Undefined command values revert with InvalidCommandType.

Supported Commands (v2)

CommandName
0x00V3_SWAP_EXACT_IN
0x01V3_SWAP_EXACT_OUT
0x02PERMIT2_TRANSFER_FROM
0x03PERMIT2_PERMIT_BATCH
0x04SWEEP
0x05TRANSFER
0x06PAY_PORTION
0x08V2_SWAP_EXACT_IN
0x09V2_SWAP_EXACT_OUT
0x0aPERMIT2_PERMIT
0x0bWRAP_ETH
0x0cUNWRAP_WETH
0x0dPERMIT2_TRANSFER_FROM_BATCH
0x0eBALANCE_CHECK_ERC20
0x10V4_SWAP
0x11V3_POSITION_MANAGER_PERMIT
0x12V3_POSITION_MANAGER_CALL
0x13V4_INITIALIZE_POOL
0x14V4_POSITION_MANAGER_CALL
0x21EXECUTE_SUB_PLAN

Command Groups

Swaps

Permit2 operations

Payments and balance checks

Position and sub-plan operations

Safety Patterns

If you need partial-fill behavior, set the high bit on a command:

command = 0x80 | 0x00; // V3_SWAP_EXACT_IN with allow-revert

When allow-revert is used, include cleanup commands such as SWEEP to avoid stranded balances in the router.

References