forked from WalletWasabi/WalletWasabi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
plebsDontPay
(WalletWasabi#13219)
- Loading branch information
Showing
18 changed files
with
33 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
WalletWasabi/JsonConverters/DefaultValueCoordinationFeeRateAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
using NBitcoin; | ||
using System.ComponentModel; | ||
using WalletWasabi.WabiSabi.Models; | ||
|
||
namespace WalletWasabi.JsonConverters; | ||
|
||
public class DefaultValueCoordinationFeeRateAttribute : DefaultValueAttribute | ||
{ | ||
public DefaultValueCoordinationFeeRateAttribute(double feeRate, double plebsDontPayThreshold) | ||
: base(new CoordinationFeeRate((decimal)feeRate, Money.Coins((decimal)plebsDontPayThreshold))) | ||
public DefaultValueCoordinationFeeRateAttribute(double feeRate) | ||
: base(new CoordinationFeeRate((decimal)feeRate)) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,20 @@ | ||
using NBitcoin; | ||
using WalletWasabi.Helpers; | ||
|
||
namespace WalletWasabi.WabiSabi.Models; | ||
|
||
public readonly struct CoordinationFeeRate | ||
{ | ||
public static readonly CoordinationFeeRate Zero = new(0, Money.Zero); | ||
public static readonly CoordinationFeeRate Zero = new(0); | ||
|
||
public CoordinationFeeRate(decimal rate, Money plebsDontPayThreshold) | ||
public CoordinationFeeRate(decimal rate) | ||
{ | ||
Rate = Guard.InRangeAndNotNull(nameof(rate), rate, 0m, 0.01m); | ||
PlebsDontPayThreshold = plebsDontPayThreshold ?? Money.Zero; | ||
Rate = rate >= 0 ? rate : throw new ArgumentOutOfRangeException(nameof(rate)); | ||
} | ||
|
||
public decimal Rate { get; } | ||
public Money PlebsDontPayThreshold { get; } | ||
|
||
public Money GetFee(Money amount) | ||
{ | ||
// Plebs don't have to pay. | ||
if (amount <= PlebsDontPayThreshold) | ||
{ | ||
return Money.Zero; | ||
} | ||
else | ||
{ | ||
return Money.Satoshis(Math.Floor(amount.Satoshi * Rate)); | ||
} | ||
return Money.Satoshis(Math.Floor(amount.Satoshi * Rate)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters