-
Notifications
You must be signed in to change notification settings - Fork 1
/
CBR_proposal.R
50 lines (36 loc) · 1.39 KB
/
CBR_proposal.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
source("./lib.R")
coinSupply <- 400000000
RRfrac <- seq(from=0.65,to=0.85,by=0.05)
RRmintDaily <- 28000
inflationRate <- RRmintDaily*365/(coinSupply*RRfrac)
years <- 50
modelSplit <- function(years,coinSupply,RRfrac,inflationRate){
res <- list()
res[["supplyRes"]] = rep(0,years)
res$supplyRes[1] <- coinSupply
reward <- rewardStruct(coinSupply,RRfrac,inflationRate,1)
res[["totalInf"]] <- rep(0,years-1)
for (year in 2:years){
grcCreatedFix <- reward$RRmint + reward$CBRmint
res$supplyRes[year] <- res$supplyRes[year-1] + grcCreatedFix
res$totalInf[year-1] <- grcCreatedFix/res$supplyRes[year-1]*100
}
return(res)
}
#Coin Supply
mOut <- modelSplit(years,coinSupply,RRfrac[1],inflationRate[1])
par(mfrow=c(2,1))
plot(1:years,mOut$supplyRes,type='l',xlab="year",ylab="Total Supply")
for (s in 2:5){
mOut <- modelSplit(years,coinSupply,RRfrac[s],inflationRate[s])
lines(1:years,mOut$supplyRes,col=s)
}
legend("topleft",legend=RRfrac,col=1:5,lty=c(1,1),lwd=c(2,2))
#Total Monetary Inflation Rate
mOut <- modelSplit(years,coinSupply,RRfrac[1],inflationRate[1])
plot(1:(years-1),mOut$totalInf,type='l',ylim=c(0,4.5),xlab="year",ylab="Monetary Inflation Rate")
for (s in 2:5){
mOut <- modelSplit(years,coinSupply,RRfrac[s],inflationRate[s])
lines(1:(years-1),mOut$totalInf,col=s)
}
legend("topright",legend=RRfrac,col=1:5,lty=c(1,1),lwd=c(2,2))