This repository was archived by the owner on Aug 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathconfig.go
More file actions
47 lines (42 loc) · 2.48 KB
/
Copy pathconfig.go
File metadata and controls
47 lines (42 loc) · 2.48 KB
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
// Copyright 2019 The Swarm Authors
// This file is part of the Swarm library.
//
// The Swarm library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The Swarm library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Swarm library. If not, see <http://www.gnu.org/licenses/>.
package swap
import (
"time"
"github.com/ethersphere/swarm/swap/int256"
)
// These are currently arbitrary values which have not been verified nor tested
// Need experimentation to arrive to values which make sense
const (
// Thresholds which trigger payment or disconnection. The unit is in honey (internal accounting unit)
// DefaultPaymentThreshold is set to be equivalent to requesting and serving 10mb of data (2441 chunks (4096 bytes) = 10 mb, 10^7 bytes = 10 mb)
defaultPaymentThreshold = 2441*RetrieveRequestPrice + (10^7)*ChunkDeliveryPrice // 4096 * 2441 = 10 mb,
defaultDisconnectThreshold = 20 * defaultPaymentThreshold
// ChequeDebtTolerance is the lowest resulting balance a node is willing to accept when receiving a cheque
// the value is meant to be used below 0, as positive resulting balances should always be accepted when receiving cheques
ChequeDebtTolerance = defaultPaymentThreshold * 20 / 100 // roughly 20% of the payment threshold
// DefaultDepositAmount is the default amount to send to the contract when initially deploying
// NOTE: deliberate value for now; needs experimentation
DefaultDepositAmount = 0
// This is the amount of time in seconds which an issuer has to wait to decrease the harddeposit of a beneficiary.
// The smart-contract allows for setting this variable differently per beneficiary
defaultHarddepositTimeoutDuration = 24 * time.Hour
// Until we deploy swap officially, it's only allowed to be enabled under a specific network ID (use the --bzznetworkid flag to set it)
AllowedNetworkID = 5
DefaultTransactionTimeout = 10 * time.Minute
)
var DefaultPaymentThreshold = int256.Uint256From(defaultPaymentThreshold)
var DefaultDisconnectThreshold = int256.Uint256From(defaultDisconnectThreshold)