1

It's not clear if you edited out important sections or if they are missing. Possibility 1 - the way you are testing Possibility 2 - msg.sender doesn't have 100 tokens to spend Possibility 3 - you haven't instantiated your token instance In the example, token has no address for a contract that is actually deployed, just an interface to a hypothetical ...


1

Subhod's answer above is good, but for variety's sake, here's a version I wrote that avoids ints entirely and keeps everything uints. I've kicked the tires a bit but you should test further before deploying it. Also of course, as Nick Johnson noted on Twitter, quicksort's worst case is slow (O(n^2)) so you might want to find a faster O(n log n) one. ...


Only top voted, non community-wiki answers of a minimum length are eligible