Math fix IV

This commit is contained in:
Rick Falkvinge
2017-11-23 16:35:10 +01:00
parent 75f2175c95
commit 24dbd17338
4 changed files with 47 additions and 27 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ namespace Resources.Pages {
}
/// <summary>
/// Looks up a localized string similar to &lt;strong&gt;DUST COLLECTED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;The amount sent is smaller than the expected fee for returning it to you, which is {0} satoshis ({1} {2:N2}). The money you sent is now so-called &quot;dust&quot; on the bitcoin network, and won&apos;t be moved again.&lt;br/&gt;&lt;br/&gt;Send a higher amount to perform an echo test..
/// Looks up a localized string similar to &lt;strong&gt;DUST COLLECTED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;The amount sent is smaller than the expected fee for returning it to you, which is {0:N2} microcoins. The money you sent is now so-called &quot;dust&quot; on the bitcoin network, and won&apos;t be moved again.&lt;br/&gt;&lt;br/&gt;Send a higher amount to perform an echo test..
/// </summary>
internal static string BitcoinEchoTest_DustCollected {
get {
+1 -1
View File
@@ -371,6 +371,6 @@
<value>Government</value>
</data>
<data name="BitcoinEchoTest_DustCollected" xml:space="preserve">
<value>&lt;strong&gt;DUST COLLECTED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;The amount sent is smaller than the expected fee for returning it to you, which is {0} satoshis ({1} {2:N2}). The money you sent is now so-called "dust" on the bitcoin network, and won't be moved again.&lt;br/&gt;&lt;br/&gt;Send a higher amount to perform an echo test.</value>
<value>&lt;strong&gt;DUST COLLECTED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;The amount sent is smaller than the expected fee for returning it to you, which is {0:N2} microcoins. The money you sent is now so-called "dust" on the bitcoin network, and won't be moved again.&lt;br/&gt;&lt;br/&gt;Send a higher amount to perform an echo test.</value>
</data>
</root>
+34 -24
View File
@@ -31,35 +31,45 @@
if (outAddress == addressUsed) {
$('#paraStatus').text(verifyingText);
var donatedSatoshis = data.vout[index][outAddress];
console.log(donatedSatoshis);
sentFunds += Math.floor(donatedSatoshis * conversionRateSatoshisToCents) / 100.0;
odoSentCents.innerHTML = sentFunds; // looks weird but $('#id') not used with odo
var json = {};
json.guid = guid;
json.txHash = data.txid;
if (donatedSatoshis > minerFeeSatoshis) {
SwarmopsJS.ajaxCall('/Pages/v5/Admin/BitcoinEchoTest.aspx/ProcessTransactionReceived',
json,
function (data) {
if (data.Success) {
var minerFeeCents = (Math.floor(minerFeeSatoshis * conversionRateSatoshisToCents) / 100.0);
minerFees -= minerFeeCents;
console.log(donatedSatoshis);
console.log("Miner fee is " + minerFeeSatoshis + " satoshis, translating to " + minerFeeCents + " cents");
returnedFunds += Math.floor((donatedSatoshis - minerFeeSatoshis) * conversionRateSatoshisToCents) / 100.0;
$('#paraStatus').text(verifyingText);
console.log(donatedSatoshis);
sentFunds += Math.floor(donatedSatoshis * conversionRateSatoshisToCents) / 100.0;
odoSentCents.innerHTML = sentFunds; // looks weird but $('#id') not used with odo
odoMinerFeeCents.innerHTML = minerFees;
odoReturnedCents.innerHTML = returnedFunds;
var json = {};
json.guid = guid;
json.txHash = data.txid;
SwarmopsJS.ajaxCall('/Pages/v5/Admin/BitcoinEchoTest.aspx/ProcessTransactionReceived',
json,
function(data) {
if (data.Success) {
var minerFeeCents = (Math.floor(minerFeeSatoshis * conversionRateSatoshisToCents) / 100.0);
minerFees -= minerFeeCents;
console.log(donatedSatoshis);
console.log("Miner fee is " + minerFeeSatoshis + " satoshis, translating to " + minerFeeCents + " cents");
returnedFunds += Math.floor((donatedSatoshis - minerFeeSatoshis) * conversionRateSatoshisToCents) / 100.0;
odoMinerFeeCents.innerHTML = minerFees;
odoReturnedCents.innerHTML = returnedFunds;
$('#paraStatus').text(data.DisplayMessage);
$('#paraIntro').fadeOut().slideUp();
$('#divQr').fadeOut().slideUp();
completed = true;
}
});
} else {
// Dust collected
alertify.dialog(SwarmopsJS.unescape('<%=Localized_DustCollected%>'));
}
$('#paraStatus').text(data.DisplayMessage);
$('#paraIntro').fadeOut().slideUp();
$('#divQr').fadeOut().slideUp();
completed = true;
}
});
}
}
+11 -1
View File
@@ -31,7 +31,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin
// This page is copied from Donate, with the echo payout added to the end
this.PageTitle = Resources.Pages.Admin.BitcoinEchoTest_PageTitle;
this.InfoBoxLiteral = Resources.Pages.Admin.BitcoinEchoTest_Info;
this.InfoBoxLiteral = String.Format(Resources.Pages.Admin.BitcoinEchoTest_Info, BitcoinUtility.EchoFeeSatoshis / 100.0);
this.LabelStatus.Text = Resources.Pages.Admin.BitcoinEchoTest_StatusInitial;
this.SuppressStatisticHeaders = true;
@@ -184,5 +184,15 @@ namespace Swarmops.Frontend.Pages.v5.Admin
get { return CommonV5.JavascriptEscape(Resources.Pages.Financial.Donate_TransactionDetected); }
}
public string Localized_DustCollected
{
get
{
return
CommonV5.JavascriptEscape(String.Format(Resources.Pages.Admin.BitcoinEchoTest_DustCollected,
BitcoinUtility.EchoFeeSatoshis/100.0));
}
}
}
}