merge DP algo with truffle