Skip to content

Instantly share code, notes, and snippets.

@stefanobernardi
Last active September 11, 2017 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save stefanobernardi/d6eda1fb299d0832c3dad71a5a4fcd20 to your computer and use it in GitHub Desktop.
Save stefanobernardi/d6eda1fb299d0832c3dad71a5a4fcd20 to your computer and use it in GitHub Desktop.
Filecoin cap calculation
coins = 0.00 # just to initialize.
price = 1.00 # the price Filecoin states is the minimum
amount_raised = 52000000.00 # they've said they already sold $52M in the presale
total_filecoin_sold = 85000000.00 # the number of Filecoins already sold in the presale. This would be $52M/price (price was $0.75 and investors could choose up to 30% discount. I'm using 85M coins as an assumption (min 69M max 99M).
average_investment = 100000.00 # I'm already being generous here
while total_filecoin_sold < (200000000.00 - coins) do # 200M is the max amount of coins
price = amount_raised/40000000.00 # this is their function, it's always more than $1
price = price * 0.9 # if you want to model an average discount people will choose
coins = average_investment / price # the amount of coins you get with every investment
amount_raised = amount_raised + average_investment # let's add the investment to the total raised
total_filecoin_sold = total_filecoin_sold + coins # let's add the new coins to the total
# puts "Bought " + coins.to_s + " Filecoins at " + price.to_s + ". Total raised = $ " + amount_raised.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse + ", and total coins = " + total_filecoin_sold.to_s
end
puts "Final price is $" + price.to_s
puts "Raised $" + amount_raised.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
puts "Total filecoins sold: " + total_filecoin_sold.to_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment