You are viewing a single comment's thread from:

RE: How should one distribute a $1 trillion dollar treasure?

in #eos7 years ago (edited)

BTW, getting back on track with EOS, and regarding this point:

The expert informs him that the smart contract platform is not capable of implementing this algorithm because the cost of “gas” would be unpredictable and there is no easy, cost effective, way to maintain a sorted order book.

It would be nice to be able to set a limit price with each bid, and it does seem possible to add a sort() function in solidity, as I described in a comment on @biophil's post.

Link: The first 5 days of the EOS token sale will be unfair. Here's how to fix it.


This example by Vitalik Buterin is from 2014, but he does show an implementation of a generic quicksort algorithm that can sort object pairs. Now, I'm not sure of the "gas constraints" involved, but with a sorted object pair it should be relatively straightforward to sort by "limit price", "database ID".

For added utility, we will make our sorting function generic: we will sort pairs instead of integers. Thus, for examples, [30, 1, 90, 2, 70, 3, 50, 4] would become [ 30, 1, 50, 4, 70, 3, 90, 2 ]. Using this function, one can sort a list containing any kind of object simply by making an array of pairs where the first number is the key to sort by and the second number is a pointer to the object in parent memory or storage.

Link: Advanced Contract Programming Example: SchellingCoin
Link: GitHub SchellingCoin implementation from Ethereum Repo

I admit I'm not well-versed in EC20 contracts or serpent/solidity, but technically, shouldn't we also be able to see all the current bidders and make an outside calculation of what the expected price would be before the window closes? If so, even better if someone could "cancel their order" before the window closes if they are displeased with the expected closing price.

Coin Marketplace

STEEM 0.16
TRX 0.15
JST 0.028
BTC 55994.69
ETH 2375.77
USDT 1.00
SBD 2.31