Withdrawing (on-chain)

Withdrawing collateral from Vertex on-chain.

You can withdraw collateral from Vertex directly on-chain, by submitting a slow-mode transaction via the Endpoint contract (see Contracts for addresses).


  • This is an alternative to withdrawing collateral via our off-chain sequencer. See Withdraw Collateral for more details.

  • Slow mode transactions have a 1 USDC fee; as such, an approval of 1 USDC is required for the slow mode withdrawal to succeed.


  1. Assemble the bytes needed for a withdraw collateral transaction by encoding the following struct alongside the transaction type 2:

struct WithdrawCollateral {
    bytes32 sender;
    uint32 productId;
    uint128 amount;
    uint64 nonce;
  1. Submit the transaction via submitSlowModeTransaction on our Endpoint contract.


function withdrawVertexCollateral(address vertexEndpoint, bytes32 sender, uint32 productId, uint128 amount) internal {
    WithdrawCollateral memory withdrawal = new WithdrawCollateral(sender, productId, amount, 0);
    bytes memory tx = abi.encodePacked(2, abi.encode(withdrawal));

Once the transaction is confirmed, it may take a few seconds for it to make its way into the vertex offchain sequencer and for the withdrawal to be processed.

Last updated