Skip to content

Fine grained invest() #55

@rbharath

Description

@rbharath

At present invest() buys in bulk. That is, it gets the price from getInvestmentPrice() and purchases N market token gwei at this price. This gives an advantage to bulk orders from early adopters since they can purchase up a lot on the cheap (credit to Rei Chiang for this attack).

A more robust scheme would be to have fine grained purchase. Let's say that only M market token gwei can be purchased at a given price. (If M = 1e9, then one market token max can be purchased at the set price). Then to purchase N total, you would do a for loop:

remaining = N
while remaining > 0:
  price = getInvestmentPrice()
  purchase min(remaining, M) gwei of market token at price
  remainder -= min(remaining, M)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions