convert prices to siacoin

This commit is contained in:
2020-08-28 13:44:50 +02:00
parent f837d85be8
commit 34f530095d
2 changed files with 53 additions and 20 deletions

View File

@@ -13,26 +13,26 @@ requirements on storage and bandwidth pricing for Sia hosts.
We will only make contracts with hosts that fullfill all these requirements. We will only make contracts with hosts that fullfill all these requirements.
Keep in mind that these are maximums, you are allowed to go lower. Keep in mind that these are maximums, you are allowed to go lower.
| Requirement | Max rate | {{$price := .PixelAPI.GetSiaPrice}}
|--------------------------|------------------|
| Storage price per month | €1.50 / TB | | Requirement | Max rate EUR | Max rate SC |
| Download price | €1.00 / TB | |--------------------------|--------------|-------------|
| Upload price | €0.50 / TB | | Storage price per month | € 1.50 / TB | {{ div 1.50 $price | formatSC }} / TB |
| Contract formation price | €0.01 | | Download price | € 1.00 / TB | {{ div 1 $price | formatSC }} / TB |
| RPC price | €0.000 000 000 1 | | Upload price | € 0.50 / TB | {{ div 0.50 $price | formatSC }} / TB |
| Sector access price | €0.000 000 000 1 | | Collateral per month | € 5.00 / TB | {{ div 5 $price | formatSC }} / TB |
| Collateral per month | €3.00 / TB | | Contract formation price | € 0.01 | {{ div 0.01 $price | formatSC }} |
<sup>
Based on exchange rates from Kraken.
[Explanation of units](https://siawiki.tech/wallet/siacoin).
</sup>
This may seem low, but keep in mind that these prices are before redundancy. We This may seem low, but keep in mind that these prices are before redundancy. We
have to upload all our data three times to the Sia network in order to reach have to upload all our data three times to the Sia network in order to reach
high availability. If you multiply everything by three it becomes much more high availability. If you multiply everything by three it becomes much more
reasonable. reasonable.
The RPC price and sector access price are paid every time a single chunk of data
is read from the host. These costs ramp up quickly when frequently downloading
files. Sia only includes these settings as a way to mitigate denial of service
attacks. There is normally no need to increase these settings.
We also can't guarantee that your host will be picked when it fulfills these We also can't guarantee that your host will be picked when it fulfills these
requirements. If there is enough supply we will only pick the most reliable requirements. If there is enough supply we will only pick the most reliable
hosts available. hosts available.

View File

@@ -137,7 +137,9 @@ func (tm *TemplateManager) ParseTemplates(silent bool) {
"pageNr": tm.pageNr, "pageNr": tm.pageNr,
"add": tm.add, "add": tm.add,
"sub": tm.sub, "sub": tm.sub,
"div": tm.div,
"formatData": tm.formatData, "formatData": tm.formatData,
"formatSC": tm.formatSC,
}) })
// Parse dynamic templates // Parse dynamic templates
@@ -235,15 +237,46 @@ func (tm *TemplateManager) pageNr(s string) (nr int) {
} }
return nr return nr
} }
func (tm *TemplateManager) add(a, b interface{}) int { func (tm *TemplateManager) add(a, b interface{}) int { return detectInt(a) + detectInt(b) }
return detectInt(a) + detectInt(b) func (tm *TemplateManager) sub(a, b interface{}) int { return detectInt(a) - detectInt(b) }
} func (tm *TemplateManager) div(a, b float64) float64 { return a / b }
func (tm *TemplateManager) sub(a, b interface{}) int {
return detectInt(a) - detectInt(b)
}
func (tm *TemplateManager) formatData(i interface{}) string { func (tm *TemplateManager) formatData(i interface{}) string {
return util.FormatData(int64(detectInt(i))) return util.FormatData(int64(detectInt(i)))
} }
func (tm *TemplateManager) formatSC(amt float64) string {
var fmtSize = func(n float64, u string) string {
var f string
if n >= 100 {
f = "%.1f"
} else if n >= 10 {
f = "%.2f"
} else {
f = "%.3f"
}
return fmt.Sprintf(f+" "+u, n)
}
// if amt >= 1e12 {
// return fmtSize(amt/1e12, "TS")
// } else if amt >= 1e9 {
// return fmtSize(amt/1e9, "GS")
// } else if amt >= 1e6 {
// return fmtSize(amt/1e6, "MS")
// } else if amt >= 1e3 {
// return fmtSize(amt/1e3, "KS")
if amt >= 1 {
return fmtSize(amt, "SC")
} else if amt >= 1e-3 {
return fmtSize(amt/1e-3, "mS")
} else if amt >= 1e-6 {
return fmtSize(amt/1e-6, "μS")
} else if amt >= 1e-9 {
return fmtSize(amt/1e-9, "nS")
} else if amt >= 1e-12 {
return fmtSize(amt/1e-12, "pS")
}
return fmtSize(amt/1e-24, "H")
}
func detectInt(i interface{}) int { func detectInt(i interface{}) int {
switch v := i.(type) { switch v := i.(type) {