go-waku/waku/v2/protocol/swap/waku_swap_option.go
Anthony Laibe 3571f0bab9 feat: init swap protocol
* Add proto files
* Add options
* Add credit/debit for soft mode
2021-11-24 13:58:35 +01:00

30 lines
557 B
Go

package swap
type SwapParameters struct {
mode int
paymentThreshold int
disconnectThreshold int
}
type SwapOption func(*SwapParameters)
func WithMode(mode int) SwapOption {
return func(params *SwapParameters) {
params.mode = mode
}
}
func WithThreshold(payment, disconnect int) SwapOption {
return func(params *SwapParameters) {
params.disconnectThreshold = disconnect
params.paymentThreshold = payment
}
}
func DefaultOptions() []SwapOption {
return []SwapOption{
WithMode(SoftMode),
WithThreshold(100, -100),
}
}