build contractVertices function