Skip to content

Instantly share code, notes, and snippets.

@theBeardA
Last active August 29, 2023 21:28
Show Gist options
  • Save theBeardA/e6dd6bd81e8ed46d8ab3a1afb0bd6f2e to your computer and use it in GitHub Desktop.
Save theBeardA/e6dd6bd81e8ed46d8ab3a1afb0bd6f2e to your computer and use it in GitHub Desktop.
NME Algorithm
Algorithm: NME
Inputs:
node_count, daily_operating_cost, operating_margin,
total_revenue, flk_price, circulating_supply, discount_rate, stake,
market_price, current_epoch, last_stake_change, optimal_ratio
Outputs:
flk_emissions, updated_stake, updated_operating_margin
Begin:
// Calculate Emissions
total_operating_expense = node_count * daily_operating_cost
emissions_value_in_usd = total_operating_expense * (1 + operating_margin) - total_revenue
flk_emissions = emissions_value_in_usd / flk_price
// Update Supply and NPV
circulating_supply += flk_emissions
yearly_cash_flow = daily_operating_cost * 365 * node_count * operating_margin
npv = yearly_cash_flow / discount_rate
flk_npv_price = npv / circulating_supply
// Adjust Operating Margins
operating_margin = (npv < market_price) ? Increase operating_margin : Decrease operating_margin
// Metrics Calculation
participation_rate = (node_count * stake) / circulating_supply
usage_to_node_ratio = total_revenue / node_count
stake_evaluation_due = (current_epoch - last_stake_change) > 365
high_participation = participation_rate > 0.5
usage_to_node_high = usage_to_node_ratio > optimal_ratio
// Decision Making
IF high_participation AND usage_to_node_high THEN
Increase operating_margin
ELSE IF NOT high_participation THEN
Increase operating_margin
IF stake_evaluation_due ANDparticipation_rate < 0.3 THEN
Decrease stake
END IF
ELSE IF high_participation AND NOT usage_to_node_high THEN
Decrease operating_margin
IF stake_evaluation_due AND participation_rate < 0.8 THEN
Increase stake
END IF
ELSE IF usage_to_node_high THEN
Increase operating_margin
IF stake_evaluation_due AND participation_rate < 0.3 THEN
Decrease stake
END IF
END IF
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment