Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace SAI with LUSD #286

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added img/lusd_grey_120x120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/lusd_grey_60x60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/lusd_red_120x120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/lusd_red_60x60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/sai_grey_120x120.png
Binary file not shown.
Binary file removed img/sai_grey_60x60.png
Binary file not shown.
Binary file removed img/sai_red_120x120.png
Binary file not shown.
Binary file removed img/sai_red_60x60.png
Binary file not shown.
4 changes: 2 additions & 2 deletions src/GWallet.Backend.Tests/CompoundBalanceCaching.fs
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,12 @@ type CompoundBalanceCaching() =
File.Delete cacheFiles.ServerStats.FullName

[<Test>]
member __.``substracting both currency X(e.g. SAI) and the currency Y(e.g.ETH) where fees are spent``() =
member __.``substracting both currency X(e.g. DAI) and the currency Y(e.g.ETH) where fees are spent``() =
let cache,cacheFiles =
SpawnNewCacheInstanceToTest high_expiration_span_because_this_test_doesnt_involve_timing

try
let someTokenCurrency = Currency.SAI
let someTokenCurrency = Currency.DAI
let someTokenBalance = 10m
let someEthCurrency = Currency.ETH
let someEthBalance = 5m
Expand Down
20 changes: 10 additions & 10 deletions src/GWallet.Backend.Tests/Deserialization.fs
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ type Deserialization() =
Is.EqualTo(2))

[<Test>]
member __.``unsigned SAI transaction import``() =
member __.``unsigned DAI transaction import``() =
let deserializedUnsignedTrans: UnsignedTransaction<IBlockchainFeeInfo> =
Account.ImportUnsignedTransactionFromJson
MarshallingData.UnsignedSaiTransactionExampleInJson
MarshallingData.UnsignedDaiTransactionExampleInJson

Assert.That(deserializedUnsignedTrans, Is.Not.Null)
Assert.That(deserializedUnsignedTrans.Proposal, Is.Not.Null)
Expand All @@ -192,28 +192,28 @@ type Deserialization() =
Assert.That(deserializedUnsignedTrans.Proposal.Amount.ValueToSend, Is.EqualTo(1m))
Assert.That(deserializedUnsignedTrans.Proposal.Amount.BalanceAtTheMomentOfSending,
Is.EqualTo 7.08m)
Assert.That(deserializedUnsignedTrans.Proposal.Amount.Currency, Is.EqualTo Currency.SAI)
Assert.That(deserializedUnsignedTrans.Proposal.Amount.Currency, Is.EqualTo Currency.DAI)
Assert.That(deserializedUnsignedTrans.Proposal.DestinationAddress,
Is.EqualTo("0xDb0381B1a380d8db2724A9Ca2d33E0C6C044bE3b"))
Assert.That(deserializedUnsignedTrans.Proposal.OriginMainAddress,
Is.EqualTo("0xba766d6d13E2Cc921Bf6e896319D32502af9e37E"))

let saiTxMetadata = deserializedUnsignedTrans.Metadata :?> Ether.TransactionMetadata
Assert.That(saiTxMetadata.TransactionCount, Is.EqualTo(7))
Assert.That(saiTxMetadata.Fee.Currency, Is.EqualTo(Currency.ETH))
Assert.That(saiTxMetadata.Fee.GasPriceInWei, Is.EqualTo(3343750000L))
let daiTxMetadata = deserializedUnsignedTrans.Metadata :?> Ether.TransactionMetadata
Assert.That(daiTxMetadata.TransactionCount, Is.EqualTo(7))
Assert.That(daiTxMetadata.Fee.Currency, Is.EqualTo(Currency.ETH))
Assert.That(daiTxMetadata.Fee.GasPriceInWei, Is.EqualTo(3343750000L))
Assert.That(deserializedUnsignedTrans.Metadata.FeeEstimationTime,
Is.EqualTo MarshallingData.SomeDate)

Assert.That(deserializedUnsignedTrans.Cache.Balances.Count, Is.EqualTo 5)
Assert.That(deserializedUnsignedTrans.Cache.UsdPrice.Count, Is.EqualTo(5))

[<Test>]
member __.``signed SAI transaction import``() =
member __.``signed DAI transaction import``() =

let deserializedSignedTrans: SignedTransaction<IBlockchainFeeInfo> =
Account.ImportSignedTransactionFromJson
MarshallingData.SignedSaiTransactionExampleInJson
MarshallingData.SignedDaiTransactionExampleInJson

Assert.That(deserializedSignedTrans, Is.Not.Null)

Expand All @@ -230,7 +230,7 @@ type Deserialization() =
Assert.That(deserializedSignedTrans.TransactionInfo.Proposal.Amount.BalanceAtTheMomentOfSending,
Is.EqualTo 7.08m)
Assert.That(deserializedSignedTrans.TransactionInfo.Proposal.Amount.Currency,
Is.EqualTo Currency.SAI)
Is.EqualTo Currency.DAI)
Assert.That(deserializedSignedTrans.TransactionInfo.Proposal.DestinationAddress,
Is.EqualTo("0xDb0381B1a380d8db2724A9Ca2d33E0C6C044bE3b"))
Assert.That(deserializedSignedTrans.TransactionInfo.Proposal.OriginMainAddress,
Expand Down
4 changes: 2 additions & 2 deletions src/GWallet.Backend.Tests/GWallet.Backend.Tests-legacy.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
<Compile Include="StratumParsing.fs" />
<Content Include="packages.config" />
<EmbeddedResource Include="data\signedAndFormattedBtcTransaction.json" />
<EmbeddedResource Include="data\signedAndFormattedSaiTransaction.json" />
<EmbeddedResource Include="data\unsignedAndFormattedSaiTransaction.json" />
<EmbeddedResource Include="data\signedAndFormattedDaiTransaction.json" />
<EmbeddedResource Include="data\unsignedAndFormattedDaiTransaction.json" />
<EmbeddedResource Include="data\unsignedAndFormattedBtcTransaction.json" />
<EmbeddedResource Include="data\signedAndFormattedEtherTransaction.json" />
<EmbeddedResource Include="data\unsignedAndFormattedEtherTransaction.json" />
Expand Down
4 changes: 2 additions & 2 deletions src/GWallet.Backend.Tests/GWallet.Backend.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
<EmbeddedResource Include="data\realException.json" />
<EmbeddedResource Include="data\signedAndFormattedEtherTransaction.json" />
<EmbeddedResource Include="data\customException.json" />
<EmbeddedResource Include="data\unsignedAndFormattedSaiTransaction.json" />
<EmbeddedResource Include="data\unsignedAndFormattedDaiTransaction.json" />
<EmbeddedResource Include="data\unsignedAndFormattedBtcTransaction.json" />
<EmbeddedResource Include="data\unsignedAndFormattedEtherTransaction.json" />
<EmbeddedResource Include="data\fullException.json" />
<EmbeddedResource Include="data\signedAndFormattedBtcTransaction.json" />
<EmbeddedResource Include="data\signedAndFormattedSaiTransaction.json" />
<EmbeddedResource Include="data\signedAndFormattedDaiTransaction.json" />
<EmbeddedResource Include="data\innerException.json" />
</ItemGroup>
</Project>
40 changes: 20 additions & 20 deletions src/GWallet.Backend.Tests/MarshallingData.fs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ module MarshallingData =
Fsdk.Misc.ExtractEmbeddedResourceFileContents resourceName
|> Sanitize

let UnsignedSaiTransactionExampleInJson =
ReadEmbeddedResource "unsignedAndFormattedSaiTransaction.json"
let UnsignedDaiTransactionExampleInJson =
ReadEmbeddedResource "unsignedAndFormattedDaiTransaction.json"

let SignedSaiTransactionExampleInJson =
ReadEmbeddedResource "signedAndFormattedSaiTransaction.json"
let SignedDaiTransactionExampleInJson =
ReadEmbeddedResource "signedAndFormattedDaiTransaction.json"

let BasicExceptionExampleInJson =
ReadEmbeddedResource "basicException.json"
Expand Down Expand Up @@ -196,21 +196,21 @@ module MarshallingData =
(Currency.LTC.ToString(), 173.592m);
(Currency.ETH.ToString(), 691.52m);
(Currency.ETC.ToString(), 19.8644m);
(Currency.SAI.ToString(), 1.00376m) ]
(Currency.DAI.ToString(), 1.00376m) ]
|> Map.ofSeq

let private realAddressesSample =
Map.empty.Add("3Buz1evVsQeHtDfQAmwfAKQsUzAt3f4TuR",[Currency.BTC.ToString()])
.Add("0xba766d6d13E2Cc921Bf6e896319D32502af9e37E",[Currency.ETH.ToString();
Currency.SAI.ToString()
Currency.DAI.ToString()
Currency.ETC.ToString()])
.Add("MJ88KYLTpXVigiwJGevzyxfGogmKx7WiWm",[Currency.LTC.ToString()])

let private realBalancesDataSample =
Map.empty.Add(Currency.BTC.ToString(), 0.0m)
.Add(Currency.ETH.ToString(), 7.08m)
.Add(Currency.ETC.ToString(), 8.0m)
.Add(Currency.SAI.ToString(), 1.0m)
.Add(Currency.DAI.ToString(), 1.0m)
.Add(Currency.LTC.ToString(), 0.0m)

let private realCachingDataExample =
Expand Down Expand Up @@ -253,36 +253,36 @@ module MarshallingData =
Metadata = someEtherTxMetadata;
}

let private someEtherMinerFeeForSaiTransfer = Ether.MinerFee(37298L,
let private someEtherMinerFeeForDaiTransfer = Ether.MinerFee(37298L,
3343750000L,
SomeDate,
Currency.ETH)
let private someSaiTxMetadata =
let private someDaiTxMetadata =
{
Fee = someEtherMinerFeeForSaiTransfer
Fee = someEtherMinerFeeForDaiTransfer
TransactionCount = int64 7;
}
let private someUnsignedSaiTransactionProposal =
let private someUnsignedDaiTransactionProposal =
{
OriginMainAddress = "0xba766d6d13E2Cc921Bf6e896319D32502af9e37E";
Amount = TransferAmount(1m, 7.08m, Currency.SAI)
Amount = TransferAmount(1m, 7.08m, Currency.DAI)
DestinationAddress = "0xDb0381B1a380d8db2724A9Ca2d33E0C6C044bE3b";
}
let UnsignedSaiTransactionExample =
let UnsignedDaiTransactionExample =
{
Proposal = someUnsignedSaiTransactionProposal
Proposal = someUnsignedDaiTransactionProposal
Cache = realCachingDataExample;
Metadata = someSaiTxMetadata
Metadata = someDaiTxMetadata
}
let someSaiTransactionInfo =
let someDaiTransactionInfo =
{
Proposal = someUnsignedSaiTransactionProposal
Proposal = someUnsignedDaiTransactionProposal
Cache = realCachingDataExample;
Metadata = someSaiTxMetadata
Metadata = someDaiTxMetadata
}
let SignedSaiTransactionExample =
let SignedDaiTransactionExample =
{
TransactionInfo = someSaiTransactionInfo
TransactionInfo = someDaiTransactionInfo
RawTransaction = "f8a80784c74d93708291b29489d24a6b4ccb1b6faa2625fe562bdd9a2326035980b844a9059cbb000000000000000000000000db0381b1a380d8db2724a9ca2d33e0c6c044be3b0000000000000000000000000000000000000000000000000de0b6b3a764000026a072cdeb03affd5977c76366efbc1405fbb4fa997ce72c1e4554ba9ec5ef772ddca069d522ea304efebd2537330870bc1ca9e9a6fe3eb5f8d8f66c1b82d9fc27a4bf";
}

Expand Down
16 changes: 8 additions & 8 deletions src/GWallet.Backend.Tests/Serialization.fs
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,26 @@ type Serialization() =
Is.EqualTo MarshallingData.SignedEtherTransactionExampleInJson)

[<Test>]
member __.``unsigned SAI transaction export``() =
member __.``unsigned DAI transaction export``() =
let json = Account.ExportUnsignedTransactionToJson
MarshallingData.UnsignedSaiTransactionExample
MarshallingData.UnsignedDaiTransactionExample
Assert.That(json, Is.Not.Null)
Assert.That(json, Is.Not.Empty)
Assert.That(json |> MarshallingData.Sanitize,
Is.EqualTo MarshallingData.UnsignedSaiTransactionExampleInJson)
Is.EqualTo MarshallingData.UnsignedDaiTransactionExampleInJson)

[<Test>]
member __.``signed SAI transaction export``() =
let json = Account.ExportUnsignedTransactionToJson MarshallingData.SignedSaiTransactionExample
member __.``signed DAI transaction export``() =
let json = Account.ExportUnsignedTransactionToJson MarshallingData.SignedDaiTransactionExample
Assert.That(json, Is.Not.Null)
Assert.That(json, Is.Not.Empty)
Assert.That(json|> MarshallingData.Sanitize,
Is.EqualTo MarshallingData.SignedSaiTransactionExampleInJson)
Is.EqualTo MarshallingData.SignedDaiTransactionExampleInJson)

[<Test>]
member __.``can serialize exceptions``() =
let json = Account.ExportUnsignedTransactionToJson MarshallingData.SignedSaiTransactionExample
let json = Account.ExportUnsignedTransactionToJson MarshallingData.SignedDaiTransactionExample
Assert.That(json, Is.Not.Null)
Assert.That(json, Is.Not.Empty)
Assert.That(json|> MarshallingData.Sanitize,
Is.EqualTo MarshallingData.SignedSaiTransactionExampleInJson)
Is.EqualTo MarshallingData.SignedDaiTransactionExampleInJson)
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
"Cache": {
"UsdPrice": {
"BTC": 9156.19,
"DAI": 1.00376,
"ETC": 19.8644,
"ETH": 691.52,
"LTC": 173.592,
"SAI": 1.00376
knocte marked this conversation as resolved.
Show resolved Hide resolved
"LTC": 173.592
},
"Addresses": {
"0xba766d6d13E2Cc921Bf6e896319D32502af9e37E": [
"ETH",
"SAI",
"DAI",
"ETC"
],
"3Buz1evVsQeHtDfQAmwfAKQsUzAt3f4TuR": [
Expand All @@ -54,10 +54,10 @@
},
"Balances": {
"BTC": 0.0,
"DAI": 1.0,
"ETC": 8.0,
"ETH": 7.08,
"LTC": 0.0,
"SAI": 1.0
knocte marked this conversation as resolved.
Show resolved Hide resolved
"LTC": 0.0
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"ValueToSend": 1.0,
"BalanceAtTheMomentOfSending": 7.08,
"Currency": {
"Case": "SAI"
"Case": "DAI"
}
},
"DestinationAddress": "0xDb0381B1a380d8db2724A9Ca2d33E0C6C044bE3b"
Expand All @@ -28,15 +28,15 @@
"Cache": {
"UsdPrice": {
"BTC": 9156.19,
"DAI": 1.00376,
"ETC": 19.8644,
"ETH": 691.52,
"LTC": 173.592,
"SAI": 1.00376
"LTC": 173.592
},
"Addresses": {
"0xba766d6d13E2Cc921Bf6e896319D32502af9e37E": [
"ETH",
"SAI",
"DAI",
"ETC"
],
"3Buz1evVsQeHtDfQAmwfAKQsUzAt3f4TuR": [
Expand All @@ -48,10 +48,10 @@
},
"Balances": {
"BTC": 0.0,
"DAI": 1.0,
"ETC": 8.0,
"ETH": 7.08,
"LTC": 0.0,
"SAI": 1.0
"LTC": 0.0
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
"Cache": {
"UsdPrice": {
"BTC": 9156.19,
"DAI": 1.00376,
"ETC": 19.8644,
"ETH": 691.52,
"LTC": 173.592,
"SAI": 1.00376
"LTC": 173.592
},
"Addresses": {
"0xba766d6d13E2Cc921Bf6e896319D32502af9e37E": [
"ETH",
"SAI",
"DAI",
"ETC"
],
"3Buz1evVsQeHtDfQAmwfAKQsUzAt3f4TuR": [
Expand All @@ -53,10 +53,10 @@
},
"Balances": {
"BTC": 0.0,
"DAI": 1.0,
"ETC": 8.0,
"ETH": 7.08,
"LTC": 0.0,
"SAI": 1.0
"LTC": 0.0
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ValueToSend": 1.0,
"BalanceAtTheMomentOfSending": 7.08,
"Currency": {
"Case": "SAI"
"Case": "DAI"
}
},
"DestinationAddress": "0xDb0381B1a380d8db2724A9Ca2d33E0C6C044bE3b"
Expand All @@ -27,15 +27,15 @@
"Cache": {
"UsdPrice": {
"BTC": 9156.19,
"DAI": 1.00376,
"ETC": 19.8644,
"ETH": 691.52,
"LTC": 173.592,
"SAI": 1.00376
"LTC": 173.592
},
"Addresses": {
"0xba766d6d13E2Cc921Bf6e896319D32502af9e37E": [
"ETH",
"SAI",
"DAI",
"ETC"
],
"3Buz1evVsQeHtDfQAmwfAKQsUzAt3f4TuR": [
Expand All @@ -47,10 +47,10 @@
},
"Balances": {
"BTC": 0.0,
"DAI": 1.0,
"ETC": 8.0,
"ETH": 7.08,
"LTC": 0.0,
"SAI": 1.0
"LTC": 0.0
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/GWallet.Backend/Account.fs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ module Account =

| Some (balance,imminentIncomingPayment) ->

if account.Currency = Currency.SAI && balance > 0m then
Infrastructure.ReportWarningMessage ("Some user is still using SAI (informative telemetry to avoid phasing out this currency too early)")
|> ignore<bool>

let compoundBalance,_ =
Caching.Instance.RetrieveAndUpdateLastCompoundBalance account.PublicAddress
account.Currency
Expand Down
4 changes: 2 additions & 2 deletions src/GWallet.Backend/BlockExplorer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module BlockExplorer =
| Currency.ETC ->
// maybe blockscout is better? minergate.com seems to only show blocks, not addresses
"https://etcblockexplorer.com/address/addr/"
| Currency.SAI | Currency.DAI ->
| Currency.LUSD | Currency.DAI ->
SPrintF1 "https://etherscan.io/token/%s?a=" (TokenManager.GetTokenContractAddress account.Currency)
Uri(baseUrl + account.PublicAddress)

Expand All @@ -36,6 +36,6 @@ module BlockExplorer =
"https://etherscan.io/tx/"
| Currency.ETC ->
"https://etcblockexplorer.com/tx/"
| Currency.DAI | Currency.SAI ->
| Currency.DAI | Currency.LUSD ->
"https://etherscan.io/tx/"
Uri(baseUrl + txHash)
Loading
Loading