EOS Token Sale Smart Contract May Offer BUY LIMITS after all!steemCreated with Sketch.

in #eos7 years ago (edited)

A few days back, @biophil wrote a post "The first 5 days of the EOS token sale will be unfair. Here's how to fix it" describing similar objections to those I found with the upcoming EOS Token Sale on Ethereum. In his own words, this was one of his main contentions:

Bob cannot be sure that he'll pay less than his maximum price. It's mathematically impossible for him to be sure. The only way he'd know for sure is if he could somehow wait until after everybody else has bid, check to make sure that the implied price is below his max, and then decide whether to contribute.

The only way Bob can protect himself is to contribute less than he'd like to. So a side-effect of this auction format is that people should self-limit their contributions to mitigate the pricing uncertainty. I don't know how much FOMO will counteract this.

At first, Dan's response was the following:

Unfortunately ethereum cannot implement this algorithm due to gas constraints and lack of sorted database.

However, this didn't quite sit right with me. Now, granted I'm not well versed in Solidity or ERC20 tokens (though perhaps, a bit better now after research more about it the past few days). But my first response to this was as follows:

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.

Even this didn't quite seem to be the best approach, not to mention it was an old post from back in 2014. It seems most contracts are now fully written in solidity, and that code was in serpent,.

After even more research, I came across these terrific resources on writing contracts for Ethereum:

Link: Solidity by Example, with great examples, including ones for Voting and for Open Auctions

Excellent Video Tutorials by Will Warren and Jordan Leigh...

This first video is good for newbies just dipping their toes into the Ethereum / Solidity world.

Introduction to Ethereum Smart Contract Development with Solidity (Part 1):

If you already have a background in Solidity, you may prefer to jump straight to the second video, where the real "meat" lies.

Introduction to Ethereum Smart Contract Development with Solidity (Part 2):

Okay Great... So get to the GOSH DARN Point!

Well, as I was doing this "research", I went back to visit the ERC20 code for the EOS Ethereum Contract to better understand what was going on, at which point I noticed a recent Pull Request that's being evaluated: buyWithLimit!

So it seems the EOS team was in the process of trying to add that "functionality" after all! More interestingly, is that they seem to have come to the same conclusion I had after watching the videos linked above. Using Solidity's "mapping" and "memory" functionality were probably the best "tricks" to help get there. And perhaps even more importantly, to "get there" in a relatively efficient manner without blowing too much Ethereum "gas" in the process.

With that functionality underway, it also shouldn't be that much more of a stretch to allow bidders to update their bids, as well as cancel their orders in the "daily pool" altogether if necessary.

For those interested in "diving in deeper" into the proposed changes and updates, here is the link to the github pull request.

Link: EOS-Token-Sale github Pull Request: test buyWithLimit

Cheers, and as always (WOW, to all 600+ of you!!), I appreciate your upvote, your follow and all your comments!

UPDATE: @eosio responded in the comments: "The limit only applies to the total received plus your funds; however, if others add after you the limit does not protect you." For more details, check the full thread in the comments below!

Sort:  

Definitely a move in the right direction. I appreciate your keeping me posted on this!

hey, no problem! And yeah, definitely a move in the right direction. Perhaps we'll still see a few more "adjustments" as well once the test run begins.

for those interested in getting involved with the EOS contract test run, this post explains how to go about it: "Call to arms! EOS test ICO needs you!"

The limit only applies to the total received plus your funds; however, if others add after you the limit does not protect you.

Allowing people to remove funds halfway through the day would enable large holders to manipulate the price.

ah okay, so there are still no plans to have a hard limit then? because from watching those videos, it seems feasible to iterate the bid array in memory (not using gas) until only bids that remain below their limit threshold versus the "closing price" remain. Everyone else could then be refunded their money.

At that point, it would also seem much harder for large holders to manipulate the price in any material way that would gain them a real advantage (except possibly through "fake outs"), even with the ability to cancel orders, since everyone else can also cancel up to the last minute, and be protected by a limit price as well.

Regardless what you do, there will always be someone finding a way to game it one way or another. Sort of like back in the day, watching NASDAQ Level 2 before the open when the market makers would post all sorts of whacky unmarketable bids and offers trying to influence the market open.

Keeping it simple helps, if you make it a complex game then those who can play have an advantage over those who cannot.

You certainly have a point there, and one governments often don't even bother to consider.

Respectfully, though, I'm not sure having the ability to set a hard limit price for an order throughout the entire auction process quite fits into that category. Here's an interesting research report co-written by the ex-CEO and co-founder of OANDA FX: "High-Frequency Trading in FX Markets (PDF)".

On the topic of "extreme regulation", from the above research report, this is one of my favorite examples (besides some of the nonsensical short-selling bans regulators have also tried to implement):

The most extreme form of regulation is the so-called Tobin Tax, a small
fee on transactions of financial securities. France is the first European
country to impose such a transaction tax, which amounts to
0.2%, to be paid on all transactions by companies headquartered in
France. Becchetti et al (2013) analysed the impact of the introduction
of the French Tobin tax on volume, liquidity and volatility of affected
stocks and documented that the tax has a significant impact in terms
of reduction in transaction volumes and intraday volatility.

On a side note, I also find it "humorous" that the "0.2% Tobin Tax Rate" described above is approximately what most crypto exchanges outrageously charge per side of their client's transactions. And somehow, it's still not enough to keep many of them solvent!

Haha, that last sentence is pretty crazy. And there should be a tobin tax on HFT across the board. It has nearly taken out all human trading and pro day traders are a dying breed.

Good info, thanks for sharing

thank you @charles1, glad you found it helpful!

Great info here, thanks for sharing! It'll be interesting to see how EOS takes off especially in the first few days of the token sale.

thanks @runaway-psyche, glad you found it useful!

This is really new for me... I need to learn about it. :)

Very informative @alexpmorris, (however, truthfully, I have no idea what all this means)...

so I guess I just didn't explain it well enough or simply enough. I'll have to try and do better next time! :) lol

Well, I was being half-sarcastic....

meep ! 👍👍👍

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.033
BTC 62559.43
ETH 3092.10
USDT 1.00
SBD 3.86