Skip to content

Instantly share code, notes, and snippets.

@stefanobernardi
Last active September 11, 2017 17:31
Show Gist options
  • Select an option

  • Save stefanobernardi/d6eda1fb299d0832c3dad71a5a4fcd20 to your computer and use it in GitHub Desktop.

Select an option

Save stefanobernardi/d6eda1fb299d0832c3dad71a5a4fcd20 to your computer and use it in GitHub Desktop.

Revisions

  1. stefanobernardi revised this gist Aug 4, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions filecoin.rb
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,10 @@
    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 = 10000.00 # I'm already being generous here
    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.85 # if you want to model an average discount people will choose
    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
  2. stefanobernardi revised this gist Aug 4, 2017. 1 changed file with 8 additions and 6 deletions.
    14 changes: 8 additions & 6 deletions filecoin.rb
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,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 = 69000000.00 # the number of Filecoins already sold in the presale assuming no vesting discounts
    average_investment = 100000.00 # I'm already being generous here
    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 = 10000.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
    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
    price = price * 0.85 # 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 filecoin control: " + total_filecoin_sold.to_s
    puts "Total filecoins sold: " + total_filecoin_sold.to_s
  3. stefanobernardi revised this gist Aug 3, 2017. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions filecoin.rb
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,11 @@
    total_filecoin_sold = 69000000.00 # the number of Filecoins already sold in the presale assuming no vesting discounts
    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
    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
    price = amount_raised/40000000.00 # this is their function, it's always more than $1
    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 "Raised $" + amount_raised.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
    puts "Total filecoin control: " + total_filecoin_sold.to_s
  4. stefanobernardi created this gist Aug 3, 2017.
    14 changes: 14 additions & 0 deletions filecoin.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    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 = 69000000.00 # the number of Filecoins already sold in the presale assuming no vesting discounts
    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
    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 "Raised $" + amount_raised.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
    puts "Total filecoin control: " + total_filecoin_sold.to_s