  @stefanobernardi/

# filecoin-sale ## Calculating the potential total amount raised in the Filecoin token sale

Files
• main.rb
main.rb
```1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
```
```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```
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]