...
This commit is contained in:
56
examples/threefold/incatokens/simulation.hero
Normal file
56
examples/threefold/incatokens/simulation.hero
Normal file
@@ -0,0 +1,56 @@
|
||||
!!incatokens.simulate
|
||||
name: 'inca_mainnet_simulation'
|
||||
total_supply: 10000000000
|
||||
public_pct: 0.50
|
||||
team_pct: 0.15
|
||||
treasury_pct: 0.15
|
||||
investor_pct: 0.20
|
||||
nrcol: 60
|
||||
currency: 'USD'
|
||||
epoch1_floor_uplift: 1.20
|
||||
epochn_floor_uplift: 1.20
|
||||
amm_liquidity_depth_factor: 2.0
|
||||
team_cliff_months: 12
|
||||
team_vesting_months: 36
|
||||
treasury_cliff_months: 12
|
||||
treasury_vesting_months: 48
|
||||
export_dir: './simulation_output'
|
||||
generate_csv: true
|
||||
generate_charts: true
|
||||
generate_report: true
|
||||
|
||||
!!incatokens.scenario
|
||||
name: 'Conservative'
|
||||
demands: [8000000, 8000000, 0]
|
||||
amm_trades: [0, 0, 0]
|
||||
|
||||
!!incatokens.scenario
|
||||
name: 'Moderate'
|
||||
demands: [25000000, 50000000, 0]
|
||||
amm_trades: [0, 0, 0]
|
||||
|
||||
!!incatokens.scenario
|
||||
name: 'Optimistic'
|
||||
demands: [50000000, 100000000, 0]
|
||||
amm_trades: [5000000, 10000000, 0]
|
||||
|
||||
!!incatokens.investor_round
|
||||
name: 'Seed'
|
||||
allocation_pct: 0.03
|
||||
price: 0.003
|
||||
cliff_months: 6
|
||||
vesting_months: 24
|
||||
|
||||
!!incatokens.investor_round
|
||||
name: 'Series_A'
|
||||
allocation_pct: 0.07
|
||||
price: 0.008
|
||||
cliff_months: 6
|
||||
vesting_months: 24
|
||||
|
||||
!!incatokens.investor_round
|
||||
name: 'Series_B'
|
||||
allocation_pct: 0.10
|
||||
price: 0.012
|
||||
cliff_months: 3
|
||||
vesting_months: 18
|
||||
@@ -1,21 +1,102 @@
|
||||
module incatokens
|
||||
|
||||
import freeflowuniverse.herolib.core.pathlib
|
||||
import freeflowuniverse.herolib.data.markdown
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
import os
|
||||
import time
|
||||
|
||||
// // Export simulation results to markdown report
|
||||
// pub fn (sim &Simulation) export_report(path string) ! {
|
||||
// content := sim.render_report()!
|
||||
const report_template = '# INCA Token Economic Simulation Report
|
||||
|
||||
// // Write to file
|
||||
// mut p := pathlib.get_file(
|
||||
// path: path
|
||||
// create: true
|
||||
// delete: true
|
||||
// )!
|
||||
// p.write(content)!
|
||||
// }
|
||||
## Executive Summary
|
||||
|
||||
This report presents the results of the INCA token economic simulation **{{.name}}**, analyzing various market scenarios and their impact on token distribution, pricing, and investor returns.
|
||||
|
||||
### Key Parameters
|
||||
|
||||
- **Total Token Supply**: {{.total_supply}} INCA
|
||||
- **Simulation Period**: {{.nrcol}} months
|
||||
- **Base Currency**: {{.currency}}
|
||||
|
||||
## Token Distribution & Allocation
|
||||
|
||||
{{.distribution_section}}
|
||||
|
||||
## Vesting Schedules
|
||||
|
||||
### Team Vesting
|
||||
- **Cliff Period**: {{.team_cliff_months}} months
|
||||
- **Vesting Period**: {{.team_vesting_months}} months
|
||||
- **Total Team Allocation**: {{.team_allocation}} INCA ({{.team_pct}}%)
|
||||
|
||||
### Treasury Vesting
|
||||
- **Cliff Period**: {{.treasury_cliff_months}} months
|
||||
- **Vesting Period**: {{.treasury_vesting_months}} months
|
||||
- **Total Treasury Allocation**: {{.treasury_allocation}} INCA ({{.treasury_pct}}%)
|
||||
|
||||
## Economic Parameters
|
||||
|
||||
- **Epoch 1 Floor Uplift**: {{.epoch1_floor_uplift}}x
|
||||
- **Subsequent Epoch Floor Uplift**: {{.epochn_floor_uplift}}x
|
||||
- **AMM Liquidity Depth Factor**: {{.amm_liquidity_depth_factor}}x
|
||||
|
||||
## Simulation Scenarios
|
||||
|
||||
{{.scenarios_section}}
|
||||
|
||||
## Financial Summary
|
||||
|
||||
{{.financial_summary}}
|
||||
|
||||
## Investment Analysis
|
||||
|
||||
### Return on Investment by Round
|
||||
|
||||
{{.roi_analysis}}
|
||||
|
||||
## Market Dynamics
|
||||
|
||||
### Price Evolution
|
||||
The token price evolution across different scenarios shows:
|
||||
|
||||
{{.price_analysis}}
|
||||
|
||||
### Market Capitalization
|
||||
The projected market capitalization ranges show:
|
||||
|
||||
{{.market_cap_analysis}}
|
||||
|
||||
## Risk Analysis
|
||||
|
||||
### Scenario Sensitivity
|
||||
The simulation reveals the following sensitivities:
|
||||
|
||||
- **Low Demand Scenario**: Conservative market conditions with limited speculation
|
||||
- **Medium Demand Scenario**: Moderate market interest and trading activity
|
||||
- **High Demand Scenario**: Strong market demand and active secondary trading
|
||||
|
||||
### Key Risk Factors
|
||||
1. **Market Demand Volatility**: Significant impact on final token prices
|
||||
2. **AMM Pool Dynamics**: Trading activity affects liquidity and price stability
|
||||
3. **Vesting Schedule Impact**: Lock-up periods influence circulating supply
|
||||
|
||||
## Conclusions
|
||||
|
||||
{{.conclusions}}
|
||||
|
||||
## Appendices
|
||||
|
||||
### A. Methodology
|
||||
This simulation uses a simplified Dutch auction model combined with AMM (Automated Market Maker) dynamics to project token price evolution.
|
||||
|
||||
### B. Assumptions
|
||||
- All investor rounds are fully subscribed
|
||||
- Vesting schedules are strictly enforced
|
||||
- Market dynamics follow the implemented auction and AMM models
|
||||
|
||||
---
|
||||
|
||||
*Report generated on {{.generation_date}} using INCA Token Simulation Framework*
|
||||
'
|
||||
|
||||
// Export data to CSV
|
||||
pub fn (sim Simulation) export_csv(sheet_name string, path string) ! {
|
||||
@@ -93,3 +174,128 @@ pub fn (sim Simulation) generate_financial_summary() !string {
|
||||
|
||||
return lines.join('\n')
|
||||
}
|
||||
|
||||
// Method to generate report from simulation
|
||||
pub fn (sim Simulation) generate_report(output_dir string) ! {
|
||||
// Ensure output directory exists
|
||||
mut output_path := pathlib.get_dir(path: output_dir, create: true)!
|
||||
|
||||
// Prepare template variables
|
||||
mut vars := map[string]string{}
|
||||
vars['name'] = sim.name
|
||||
vars['total_supply'] = sim.total_supply.str()
|
||||
vars['nrcol'] = sim.price_sheet.nrcol.str()
|
||||
vars['currency'] = sim.currency
|
||||
vars['team_cliff_months'] = sim.team_vesting.cliff_months.str()
|
||||
vars['team_vesting_months'] = sim.team_vesting.vesting_months.str()
|
||||
vars['team_allocation'] = (sim.total_supply * sim.team_pct).str()
|
||||
vars['team_pct'] = (sim.team_pct * 100).str()
|
||||
vars['treasury_cliff_months'] = sim.treasury_vesting.cliff_months.str()
|
||||
vars['treasury_vesting_months'] = sim.treasury_vesting.vesting_months.str()
|
||||
vars['treasury_allocation'] = (sim.total_supply * sim.treasury_pct).str()
|
||||
vars['treasury_pct'] = (sim.treasury_pct * 100).str()
|
||||
vars['epoch1_floor_uplift'] = sim.epoch1_floor_uplift.str()
|
||||
vars['epochn_floor_uplift'] = sim.epochn_floor_uplift.str()
|
||||
vars['amm_liquidity_depth_factor'] = sim.amm_liquidity_depth_factor.str()
|
||||
vars['generation_date'] = time.now().format()
|
||||
|
||||
// Generate sections
|
||||
vars['distribution_section'] = sim.generate_distribution_section()!
|
||||
vars['scenarios_section'] = sim.generate_scenarios_section()!
|
||||
vars['financial_summary'] = sim.generate_financial_summary()!
|
||||
vars['roi_analysis'] = sim.generate_roi_analysis()!
|
||||
vars['price_analysis'] = sim.generate_price_analysis()!
|
||||
vars['market_cap_analysis'] = sim.generate_market_cap_analysis()!
|
||||
vars['conclusions'] = sim.generate_conclusions()!
|
||||
|
||||
// Process template
|
||||
mut content := report_template
|
||||
for key, value in vars {
|
||||
content = content.replace('{{.${key}}}', value)
|
||||
}
|
||||
|
||||
// Write report
|
||||
report_path := '${output_path.path}/${sim.name}_report.md'
|
||||
mut report_file := pathlib.get_file(path: report_path, create: true)!
|
||||
report_file.write(content)!
|
||||
|
||||
console.print_green('✓ Report generated: ${report_path}')
|
||||
}
|
||||
|
||||
// Additional template methods for generating report sections
|
||||
pub fn (sim Simulation) generate_scenarios_section() !string {
|
||||
mut lines := []string{}
|
||||
|
||||
for name, scenario in sim.scenarios {
|
||||
lines << sim.generate_scenario_section(scenario)!
|
||||
lines << ''
|
||||
}
|
||||
|
||||
return lines.join('\n')
|
||||
}
|
||||
|
||||
pub fn (sim Simulation) generate_roi_analysis() !string {
|
||||
mut lines := []string{}
|
||||
|
||||
lines << '| Investor Round | Price | Allocation | '
|
||||
for scenario_name, _ in sim.scenarios {
|
||||
lines[0] += '${scenario_name} ROI | '
|
||||
}
|
||||
lines << '|' + '---|'.repeat(3 + sim.scenarios.len)
|
||||
|
||||
for round in sim.investor_rounds {
|
||||
mut row := '| **${round.name}** | \$${round.price} | ${(round.allocation_pct * 100).str()}% | '
|
||||
for scenario_name, scenario in sim.scenarios {
|
||||
roi := scenario.final_metrics.investor_roi[round.name] or { 0.0 }
|
||||
row += '${roi:.2f}x | '
|
||||
}
|
||||
lines << row
|
||||
}
|
||||
|
||||
return lines.join('\n')
|
||||
}
|
||||
|
||||
pub fn (sim Simulation) generate_price_analysis() !string {
|
||||
mut lines := []string{}
|
||||
|
||||
lines << '| Scenario | Final Price | Price Change |'
|
||||
lines << '|---|---|---|'
|
||||
|
||||
initial_price := sim.get_last_investor_price()
|
||||
for name, scenario in sim.scenarios {
|
||||
final_price := scenario.final_metrics.final_price
|
||||
change_pct := ((final_price - initial_price) / initial_price) * 100
|
||||
lines << '| **${name}** | \$${final_price:.4f} | ${change_pct:+.1f}% |'
|
||||
}
|
||||
|
||||
return lines.join('\n')
|
||||
}
|
||||
|
||||
pub fn (sim Simulation) generate_market_cap_analysis() !string {
|
||||
mut lines := []string{}
|
||||
|
||||
lines << '| Scenario | Market Cap | Market Cap Range |'
|
||||
lines << '|---|---|---|'
|
||||
|
||||
for name, scenario in sim.scenarios {
|
||||
mc := scenario.final_metrics.market_cap_final / 1_000_000 // In millions
|
||||
lines << '| **${name}** | \$${mc:.1f}M | Varies by circulating supply |'
|
||||
}
|
||||
|
||||
return lines.join('\n')
|
||||
}
|
||||
|
||||
pub fn (sim Simulation) generate_conclusions() !string {
|
||||
mut lines := []string{}
|
||||
|
||||
lines << 'Based on the simulation results:'
|
||||
lines << ''
|
||||
lines << '1. **Token Price Sensitivity**: The final token price shows significant sensitivity to market demand levels'
|
||||
lines << '2. **Investor Returns**: All investor rounds show positive returns across scenarios'
|
||||
lines << '3. **Treasury Funding**: The INCA COOP successfully raises substantial funding through the token sale'
|
||||
lines << '4. **Market Dynamics**: The combination of auction and AMM mechanisms provides price discovery and liquidity'
|
||||
lines << ''
|
||||
lines << 'The simulation demonstrates a robust token economic model that balances investor returns, treasury funding, and market dynamics.'
|
||||
|
||||
return lines.join('\n')
|
||||
}
|
||||
@@ -7,6 +7,20 @@ __global (
|
||||
simulations map[string]&Simulation
|
||||
)
|
||||
|
||||
// Create simulation from parameters struct
|
||||
pub fn simulation_new_from_params(params SimulationParams) !&Simulation {
|
||||
return simulation_new(
|
||||
name: params.name
|
||||
total_supply: params.distribution.total_supply
|
||||
public_pct: params.distribution.public_pct
|
||||
team_pct: params.distribution.team_pct
|
||||
treasury_pct: params.distribution.treasury_pct
|
||||
investor_pct: params.distribution.investor_pct
|
||||
nrcol: params.simulation.nrcol
|
||||
currency: params.simulation.currency
|
||||
)!
|
||||
}
|
||||
|
||||
@[params]
|
||||
pub struct SimulationNewArgs {
|
||||
pub mut:
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
module incatokens
|
||||
|
||||
fn test_simulation_creation() {
|
||||
mut sim := simulation_new(name: 'test_sim')!
|
||||
sim.init_default_rounds()!
|
||||
import os
|
||||
|
||||
assert sim.name == 'test_sim'
|
||||
assert sim.total_supply == 10_000_000_000
|
||||
assert sim.investor_rounds.len == 3
|
||||
fn test_simulation_creation() {
|
||||
mut params := default_params()
|
||||
params.name = 'test_sim_creation'
|
||||
|
||||
mut sim := simulation_new_from_params(params)!
|
||||
|
||||
assert sim.name == 'test_sim_creation'
|
||||
assert sim.total_supply == params.distribution.total_supply
|
||||
assert sim.investor_rounds.len == params.investor_rounds.len
|
||||
}
|
||||
|
||||
fn test_scenario_execution() {
|
||||
mut sim := simulation_new(name: 'test_sim')!
|
||||
sim.init_default_rounds()!
|
||||
mut params := default_params()
|
||||
params.name = 'test_scenario_exec'
|
||||
|
||||
// Run low scenario
|
||||
low_scenario := sim.run_scenario(
|
||||
'Low',
|
||||
[10_000_000.0, 10_000_000.0, 0.0],
|
||||
[0.0, 0.0, 0.0]
|
||||
)!
|
||||
mut sim := simulation_new_from_params(params)!
|
||||
sim.run_full_simulation(params)!
|
||||
|
||||
// Get the 'Low' scenario results
|
||||
low_scenario := sim.scenarios['Low']!
|
||||
|
||||
assert low_scenario.name == 'Low'
|
||||
assert low_scenario.final_metrics.treasury_total > 0
|
||||
@@ -32,9 +35,11 @@ fn test_scenario_execution() {
|
||||
}
|
||||
|
||||
fn test_vesting_schedules() {
|
||||
mut sim := simulation_new(name: 'test_sim')!
|
||||
sim.init_default_rounds()!
|
||||
sim.create_vesting_schedules()!
|
||||
mut params := default_params()
|
||||
params.name = 'test_vesting_schedules'
|
||||
|
||||
mut sim := simulation_new_from_params(params)!
|
||||
sim.run_full_simulation(params)!
|
||||
|
||||
// Check team vesting
|
||||
team_row := sim.vesting_sheet.row_get('team_vesting')!
|
||||
@@ -51,31 +56,25 @@ fn test_vesting_schedules() {
|
||||
}
|
||||
|
||||
fn test_export_functionality() {
|
||||
mut sim := simulation_new(name: 'test_export')!
|
||||
sim.init_default_rounds()!
|
||||
mut params := default_params()
|
||||
params.name = 'test_export'
|
||||
params.output.export_dir = '/tmp/incatokens_test_output'
|
||||
params.output.generate_csv = true
|
||||
params.output.generate_report = true
|
||||
|
||||
// Run scenarios
|
||||
sim.run_scenario('Low', [10_000_000.0, 10_000_000.0, 0.0], [0.0, 0.0, 0.0])!
|
||||
sim.run_scenario('High', [50_000_000.0, 100_000_000.0, 0.0], [0.0, 0.0, 0.0])!
|
||||
// Ensure output directory exists and is clean
|
||||
os.rmdir_all(params.output.export_dir) or {}
|
||||
os.mkdir_all(params.output.export_dir)!
|
||||
|
||||
// Test CSV export
|
||||
sim.export_csv('prices', '/tmp/test_prices.csv')!
|
||||
mut sim := simulation_new_from_params(params)!
|
||||
sim.run_full_simulation(params)!
|
||||
|
||||
// Test report generation
|
||||
// sim.export_report('/tmp/test_report.md')!
|
||||
// Test CSV export (already handled by run_full_simulation if generate_csv is true)
|
||||
assert os.exists('${params.output.export_dir}/${params.name}_prices.csv')
|
||||
assert os.exists('${params.output.export_dir}/${params.name}_tokens.csv')
|
||||
assert os.exists('${params.output.export_dir}/${params.name}_investments.csv')
|
||||
assert os.exists('${params.output.export_dir}/${params.name}_vesting.csv')
|
||||
|
||||
// Test report generation (already handled by run_full_simulation if generate_report is true)
|
||||
assert os.exists('${params.output.export_dir}/${params.name}_report.md')
|
||||
}
|
||||
// fn test_template_rendering() {
|
||||
// mut sim := simulation_new(name: 'test_template')!
|
||||
// sim.init_default_rounds()!
|
||||
|
||||
// // Run a scenario
|
||||
// sim.run_scenario('Low', [10_000_000.0, 10_000_000.0, 0.0], [0.0, 0.0, 0.0])!
|
||||
|
||||
// // Render the report
|
||||
// report := sim.render_report()!
|
||||
|
||||
// // Assert that the report is not empty and contains some expected text
|
||||
// assert report.len > 0
|
||||
// assert report.contains('# INCA TGE Simulation Report')
|
||||
// assert report.contains('## 1) Token Distribution & Vesting')
|
||||
// }
|
||||
193
lib/threefold/incatokens/params.v
Normal file
193
lib/threefold/incatokens/params.v
Normal file
@@ -0,0 +1,193 @@
|
||||
module incatokens
|
||||
import os
|
||||
|
||||
// TokenDistribution defines how tokens are allocated across different categories
|
||||
pub struct TokenDistribution {
|
||||
pub mut:
|
||||
total_supply f64 = 10_000_000_000
|
||||
public_pct f64 = 0.50
|
||||
team_pct f64 = 0.15
|
||||
treasury_pct f64 = 0.15
|
||||
investor_pct f64 = 0.20
|
||||
}
|
||||
|
||||
// VestingConfig defines cliff and vesting periods
|
||||
pub struct VestingConfig {
|
||||
pub mut:
|
||||
cliff_months int
|
||||
vesting_months int
|
||||
}
|
||||
|
||||
// InvestorRoundConfig defines parameters for each investment round
|
||||
pub struct InvestorRoundConfig {
|
||||
pub mut:
|
||||
name string
|
||||
allocation_pct f64
|
||||
price f64
|
||||
vesting VestingConfig
|
||||
}
|
||||
|
||||
// EconomicsConfig defines economic parameters affecting token pricing
|
||||
pub struct EconomicsConfig {
|
||||
pub mut:
|
||||
epoch1_floor_uplift f64 = 1.20
|
||||
epochn_floor_uplift f64 = 1.20
|
||||
amm_liquidity_depth_factor f64 = 2.0
|
||||
}
|
||||
|
||||
// VestingConfigs groups all vesting configurations
|
||||
pub struct VestingConfigs {
|
||||
pub mut:
|
||||
team VestingConfig
|
||||
treasury VestingConfig
|
||||
}
|
||||
|
||||
// SimulationConfig defines technical simulation parameters
|
||||
pub struct SimulationConfig {
|
||||
pub mut:
|
||||
nrcol int = 60 // Number of months to simulate
|
||||
currency string = 'USD'
|
||||
}
|
||||
|
||||
// ScenarioConfig defines a single scenario with market conditions
|
||||
pub struct ScenarioConfig {
|
||||
pub mut:
|
||||
name string
|
||||
demands []f64
|
||||
amm_trades []f64
|
||||
}
|
||||
|
||||
// OutputConfig defines where and how to generate outputs
|
||||
pub struct OutputConfig {
|
||||
pub mut:
|
||||
export_dir string = './output'
|
||||
generate_csv bool = true
|
||||
generate_charts bool = true
|
||||
generate_report bool = true
|
||||
}
|
||||
|
||||
// SimulationParams is the main configuration struct containing all parameters
|
||||
pub struct SimulationParams {
|
||||
pub mut:
|
||||
name string
|
||||
distribution TokenDistribution
|
||||
investor_rounds []InvestorRoundConfig
|
||||
vesting VestingConfigs
|
||||
economics EconomicsConfig
|
||||
simulation SimulationConfig
|
||||
scenarios []ScenarioConfig
|
||||
output OutputConfig
|
||||
}
|
||||
|
||||
// default_params returns a SimulationParams with sensible defaults
|
||||
pub fn default_params() SimulationParams {
|
||||
return SimulationParams{
|
||||
name: 'default'
|
||||
distribution: TokenDistribution{}
|
||||
investor_rounds: [
|
||||
InvestorRoundConfig{
|
||||
name: 'R1'
|
||||
allocation_pct: 0.05
|
||||
price: 0.005
|
||||
vesting: VestingConfig{cliff_months: 6, vesting_months: 24}
|
||||
},
|
||||
InvestorRoundConfig{
|
||||
name: 'R2'
|
||||
allocation_pct: 0.075
|
||||
price: 0.009
|
||||
vesting: VestingConfig{cliff_months: 6, vesting_months: 24}
|
||||
},
|
||||
InvestorRoundConfig{
|
||||
name: 'R3'
|
||||
allocation_pct: 0.075
|
||||
price: 0.0106
|
||||
vesting: VestingConfig{cliff_months: 6, vesting_months: 24}
|
||||
}
|
||||
]
|
||||
vesting: VestingConfigs{
|
||||
team: VestingConfig{cliff_months: 12, vesting_months: 36}
|
||||
treasury: VestingConfig{cliff_months: 12, vesting_months: 48}
|
||||
}
|
||||
economics: EconomicsConfig{}
|
||||
simulation: SimulationConfig{}
|
||||
scenarios: [
|
||||
ScenarioConfig{
|
||||
name: 'Low'
|
||||
demands: [10_000_000.0, 10_000_000.0, 0.0]
|
||||
amm_trades: [0.0, 0.0, 0.0]
|
||||
},
|
||||
ScenarioConfig{
|
||||
name: 'Medium'
|
||||
demands: [25_000_000.0, 50_000_000.0, 0.0]
|
||||
amm_trades: [0.0, 0.0, 0.0]
|
||||
},
|
||||
ScenarioConfig{
|
||||
name: 'High'
|
||||
demands: [50_000_000.0, 100_000_000.0, 0.0]
|
||||
amm_trades: [0.0, 0.0, 0.0]
|
||||
}
|
||||
]
|
||||
output: OutputConfig{}
|
||||
}
|
||||
}
|
||||
|
||||
// run_simulation executes the simulation with the given parameters
|
||||
pub fn (params SimulationParams) run_simulation() ! {
|
||||
mut sim := simulation_new(
|
||||
name: params.name
|
||||
total_supply: params.distribution.total_supply
|
||||
public_pct: params.distribution.public_pct
|
||||
team_pct: params.distribution.team_pct
|
||||
treasury_pct: params.distribution.treasury_pct
|
||||
investor_pct: params.distribution.investor_pct
|
||||
nrcol: params.simulation.nrcol
|
||||
currency: params.simulation.currency
|
||||
)!
|
||||
|
||||
// Configure economics
|
||||
sim.epoch1_floor_uplift = params.economics.epoch1_floor_uplift
|
||||
sim.epochn_floor_uplift = params.economics.epochn_floor_uplift
|
||||
sim.amm_liquidity_depth_factor = params.economics.amm_liquidity_depth_factor
|
||||
|
||||
// Set up investor rounds
|
||||
sim.investor_rounds = params.investor_rounds.map(InvestorRound{
|
||||
name: it.name
|
||||
allocation_pct: it.allocation_pct
|
||||
price: it.price
|
||||
vesting: VestingSchedule{
|
||||
cliff_months: it.vesting.cliff_months
|
||||
vesting_months: it.vesting.vesting_months
|
||||
}
|
||||
})
|
||||
|
||||
// Set up vesting schedules
|
||||
sim.team_vesting = VestingSchedule{
|
||||
cliff_months: params.vesting.team.cliff_months
|
||||
vesting_months: params.vesting.team.vesting_months
|
||||
}
|
||||
sim.treasury_vesting = VestingSchedule{
|
||||
cliff_months: params.vesting.treasury.cliff_months
|
||||
vesting_months: params.vesting.treasury.vesting_months
|
||||
}
|
||||
|
||||
// Run scenarios
|
||||
for scenario in params.scenarios {
|
||||
sim.run_scenario(scenario.name, scenario.demands, scenario.amm_trades)!
|
||||
}
|
||||
|
||||
// Generate vesting schedules
|
||||
sim.create_vesting_schedules()!
|
||||
|
||||
// Generate outputs
|
||||
if params.output.generate_csv {
|
||||
os.mkdir_all(params.output.export_dir)!
|
||||
sim.export_csv('prices', '${params.output.export_dir}/${params.name}_prices.csv')!
|
||||
sim.export_csv('tokens', '${params.output.export_dir}/${params.name}_tokens.csv')!
|
||||
sim.export_csv('investments', '${params.output.export_dir}/${params.name}_investments.csv')!
|
||||
sim.export_csv('vesting', '${params.output.export_dir}/${params.name}_vesting.csv')!
|
||||
}
|
||||
|
||||
if params.output.generate_report {
|
||||
sim.generate_report(params.output.export_dir)!
|
||||
}
|
||||
}
|
||||
85
lib/threefold/incatokens/play.v
Normal file
85
lib/threefold/incatokens/play.v
Normal file
@@ -0,0 +1,85 @@
|
||||
module incatokens
|
||||
|
||||
import freeflowuniverse.herolib.core.playbook { PlayBook }
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
import freeflowuniverse.herolib.core.pathlib
|
||||
import os
|
||||
|
||||
pub fn play(mut plbook PlayBook) ! {
|
||||
console.print_header('INCA Token Simulation')
|
||||
|
||||
// Process simulation definitions
|
||||
for action in plbook.find(filter: 'incatokens.simulate')! {
|
||||
mut p := action.params
|
||||
|
||||
// Create parameters struct
|
||||
mut params := SimulationParams{
|
||||
name: p.get_default('name', 'inca_simulation')!
|
||||
}
|
||||
|
||||
// Configure token distribution
|
||||
params.distribution.total_supply = p.get_float_default('total_supply', 10_000_000_000.0)!
|
||||
params.distribution.public_pct = p.get_float_default('public_pct', 0.50)!
|
||||
params.distribution.team_pct = p.get_float_default('team_pct', 0.15)!
|
||||
params.distribution.treasury_pct = p.get_float_default('treasury_pct', 0.15)!
|
||||
params.distribution.investor_pct = p.get_float_default('investor_pct', 0.20)!
|
||||
|
||||
// Configure simulation settings
|
||||
params.simulation.nrcol = p.get_int_default('nrcol', 60)!
|
||||
params.simulation.currency = p.get_default('currency', 'USD')!
|
||||
|
||||
// Configure economics
|
||||
params.economics.epoch1_floor_uplift = p.get_float_default('epoch1_floor_uplift', 1.20)!
|
||||
params.economics.epochn_floor_uplift = p.get_float_default('epochn_floor_uplift', 1.20)!
|
||||
params.economics.amm_liquidity_depth_factor = p.get_float_default('amm_liquidity_depth_factor', 2.0)!
|
||||
|
||||
// Configure vesting
|
||||
params.vesting.team.cliff_months = p.get_int_default('team_cliff_months', 12)!
|
||||
params.vesting.team.vesting_months = p.get_int_default('team_vesting_months', 36)!
|
||||
params.vesting.treasury.cliff_months = p.get_int_default('treasury_cliff_months', 12)!
|
||||
params.vesting.treasury.vesting_months = p.get_int_default('treasury_vesting_months', 48)!
|
||||
|
||||
// Configure output
|
||||
params.output.export_dir = p.get_default('export_dir', './output')!
|
||||
params.output.generate_csv = p.get_default_true('generate_csv')
|
||||
params.output.generate_charts = p.get_default_true('generate_charts')
|
||||
params.output.generate_report = p.get_default_true('generate_report')
|
||||
|
||||
console.print_item('Running simulation: ${params.name}')
|
||||
|
||||
// Run the simulation
|
||||
params.run_simulation()!
|
||||
|
||||
console.print_green('✓ Simulation completed successfully')
|
||||
}
|
||||
|
||||
// Process investor round definitions
|
||||
for action in plbook.find(filter: 'incatokens.investor_round')! {
|
||||
mut p := action.params
|
||||
|
||||
round := InvestorRoundConfig{
|
||||
name: p.get('name')!
|
||||
allocation_pct: p.get_float('allocation_pct')!
|
||||
price: p.get_float('price')!
|
||||
vesting: VestingConfig{
|
||||
cliff_months: p.get_int('cliff_months')!
|
||||
vesting_months: p.get_int('vesting_months')!
|
||||
}
|
||||
}
|
||||
|
||||
console.print_item('Configured investor round: ${round.name} at \$${round.price}')
|
||||
}
|
||||
|
||||
// Process scenario definitions
|
||||
for action in plbook.find(filter: 'incatokens.scenario')! {
|
||||
mut p := action.params
|
||||
|
||||
scenario := ScenarioConfig{
|
||||
name: p.get('name')!
|
||||
demands: p.get_list_f64('demands')!
|
||||
amm_trades: p.get_list_f64('amm_trades')!
|
||||
}
|
||||
|
||||
console.print_item('Configured scenario: ${scenario.name}')
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
module incatokens
|
||||
|
||||
import freeflowuniverse.herolib.biz.spreadsheet
|
||||
// import freeflowuniverse.herolib.biz.spreadsheet
|
||||
|
||||
// Initialize default investor rounds
|
||||
pub fn (mut sim Simulation) init_default_rounds() ! {
|
||||
@@ -29,6 +29,43 @@ pub fn (mut sim Simulation) init_default_rounds() ! {
|
||||
sim.treasury_vesting = VestingSchedule{cliff_months: 12, vesting_months: 48}
|
||||
}
|
||||
|
||||
// Generate comprehensive report with all scenarios
|
||||
pub fn (mut sim Simulation) run_full_simulation(params SimulationParams) ! {
|
||||
// Configure from parameters
|
||||
sim.epoch1_floor_uplift = params.economics.epoch1_floor_uplift
|
||||
sim.epochn_floor_uplift = params.economics.epochn_floor_uplift
|
||||
sim.amm_liquidity_depth_factor = params.economics.amm_liquidity_depth_factor
|
||||
|
||||
// Set up investor rounds
|
||||
sim.investor_rounds = params.investor_rounds.map(InvestorRound{
|
||||
name: it.name
|
||||
allocation_pct: it.allocation_pct
|
||||
price: it.price
|
||||
vesting: VestingSchedule{
|
||||
cliff_months: it.vesting.cliff_months
|
||||
vesting_months: it.vesting.vesting_months
|
||||
}
|
||||
})
|
||||
|
||||
// Set up vesting schedules
|
||||
sim.team_vesting = VestingSchedule{
|
||||
cliff_months: params.vesting.team.cliff_months
|
||||
vesting_months: params.vesting.team.vesting_months
|
||||
}
|
||||
sim.treasury_vesting = VestingSchedule{
|
||||
cliff_months: params.vesting.treasury.cliff_months
|
||||
vesting_months: params.vesting.treasury.vesting_months
|
||||
}
|
||||
|
||||
// Run all scenarios
|
||||
for scenario_config in params.scenarios {
|
||||
sim.run_scenario(scenario_config.name, scenario_config.demands, scenario_config.amm_trades)!
|
||||
}
|
||||
|
||||
// Generate vesting schedules
|
||||
sim.create_vesting_schedules()!
|
||||
}
|
||||
|
||||
// Run a scenario with given demands and AMM trades
|
||||
pub fn (mut sim Simulation) run_scenario(name string, demands []f64, amm_trades []f64) !&Scenario {
|
||||
mut scenario := &Scenario{
|
||||
|
||||
91
lib/threefold/incatokens/templates/report.md
Normal file
91
lib/threefold/incatokens/templates/report.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# INCA Token Economic Simulation Report
|
||||
|
||||
## Executive Summary
|
||||
|
||||
This report presents the results of the INCA token economic simulation **{{.name}}**, analyzing various market scenarios and their impact on token distribution, pricing, and investor returns.
|
||||
|
||||
### Key Parameters
|
||||
|
||||
- **Total Token Supply**: {{.total_supply}} INCA
|
||||
- **Simulation Period**: {{.nrcol}} months
|
||||
- **Base Currency**: {{.currency}}
|
||||
|
||||
## Token Distribution & Allocation
|
||||
|
||||
{{.distribution_section}}
|
||||
|
||||
## Vesting Schedules
|
||||
|
||||
### Team Vesting
|
||||
- **Cliff Period**: {{.team_cliff_months}} months
|
||||
- **Vesting Period**: {{.team_vesting_months}} months
|
||||
- **Total Team Allocation**: {{.team_allocation}} INCA ({{.team_pct}}%)
|
||||
|
||||
### Treasury Vesting
|
||||
- **Cliff Period**: {{.treasury_cliff_months}} months
|
||||
- **Vesting Period**: {{.treasury_vesting_months}} months
|
||||
- **Total Treasury Allocation**: {{.treasury_allocation}} INCA ({{.treasury_pct}}%)
|
||||
|
||||
## Economic Parameters
|
||||
|
||||
- **Epoch 1 Floor Uplift**: {{.epoch1_floor_uplift}}x
|
||||
- **Subsequent Epoch Floor Uplift**: {{.epochn_floor_uplift}}x
|
||||
- **AMM Liquidity Depth Factor**: {{.amm_liquidity_depth_factor}}x
|
||||
|
||||
## Simulation Scenarios
|
||||
|
||||
{{.scenarios_section}}
|
||||
|
||||
## Financial Summary
|
||||
|
||||
{{.financial_summary}}
|
||||
|
||||
## Investment Analysis
|
||||
|
||||
### Return on Investment by Round
|
||||
|
||||
{{.roi_analysis}}
|
||||
|
||||
## Market Dynamics
|
||||
|
||||
### Price Evolution
|
||||
The token price evolution across different scenarios shows:
|
||||
|
||||
{{.price_analysis}}
|
||||
|
||||
### Market Capitalization
|
||||
The projected market capitalization ranges show:
|
||||
|
||||
{{.market_cap_analysis}}
|
||||
|
||||
## Risk Analysis
|
||||
|
||||
### Scenario Sensitivity
|
||||
The simulation reveals the following sensitivities:
|
||||
|
||||
- **Low Demand Scenario**: Conservative market conditions with limited speculation
|
||||
- **Medium Demand Scenario**: Moderate market interest and trading activity
|
||||
- **High Demand Scenario**: Strong market demand and active secondary trading
|
||||
|
||||
### Key Risk Factors
|
||||
1. **Market Demand Volatility**: Significant impact on final token prices
|
||||
2. **AMM Pool Dynamics**: Trading activity affects liquidity and price stability
|
||||
3. **Vesting Schedule Impact**: Lock-up periods influence circulating supply
|
||||
|
||||
## Conclusions
|
||||
|
||||
{{.conclusions}}
|
||||
|
||||
## Appendices
|
||||
|
||||
### A. Methodology
|
||||
This simulation uses a simplified Dutch auction model combined with AMM (Automated Market Maker) dynamics to project token price evolution.
|
||||
|
||||
### B. Assumptions
|
||||
- All investor rounds are fully subscribed
|
||||
- Vesting schedules are strictly enforced
|
||||
- Market dynamics follow the implemented auction and AMM models
|
||||
|
||||
---
|
||||
|
||||
*Report generated on {{.generation_date}} using INCA Token Simulation Framework*
|
||||
Reference in New Issue
Block a user