Skip to content

Commit b20d5fd

Browse files
committed
Backend,Frontend: introduce LUSD currency
Added LUSD value to Currency enum and made relevant code changes. Also added icons for LUSD.
1 parent 75619d5 commit b20d5fd

11 files changed

+25
-8
lines changed

img/lusd_grey_120x120.png

4.73 KB
Loading

img/lusd_grey_60x60.png

2.31 KB
Loading

img/lusd_red_120x120.png

5 KB
Loading

img/lusd_red_60x60.png

2.45 KB
Loading

src/GWallet.Backend/BlockExplorer.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module BlockExplorer =
2121
| Currency.ETC ->
2222
// maybe blockscout is better? minergate.com seems to only show blocks, not addresses
2323
"https://etcblockexplorer.com/address/addr/"
24-
| Currency.DAI ->
24+
| Currency.LUSD | Currency.DAI ->
2525
SPrintF1 "https://etherscan.io/token/%s?a=" (TokenManager.GetTokenContractAddress account.Currency)
2626
Uri(baseUrl + account.PublicAddress)
2727

@@ -36,6 +36,6 @@ module BlockExplorer =
3636
"https://etherscan.io/tx/"
3737
| Currency.ETC ->
3838
"https://etcblockexplorer.com/tx/"
39-
| Currency.DAI ->
39+
| Currency.DAI | Currency.LUSD ->
4040
"https://etherscan.io/tx/"
4141
Uri(baseUrl + txHash)

src/GWallet.Backend/Currency.fs

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type Currency =
1414
| ETH
1515
| ETC
1616
| DAI
17+
| LUSD
1718
// </NOTE>
1819

1920
#if STRICTER_COMPILATION_BUT_WITH_REFLECTION_AT_RUNTIME
@@ -32,6 +33,7 @@ type Currency =
3233
yield ETH
3334
yield ETC
3435
yield DAI
36+
yield LUSD
3537
}
3638
#endif
3739

@@ -41,7 +43,7 @@ type Currency =
4143
member self.IsEther() =
4244
self = Currency.ETC || self = Currency.ETH
4345
member self.IsEthToken() =
44-
self = Currency.DAI
46+
self = Currency.DAI || self = Currency.LUSD
4547
member self.IsEtherBased() =
4648
self.IsEther() || self.IsEthToken()
4749
member self.IsUtxo() =
@@ -52,7 +54,7 @@ type Currency =
5254
8
5355
elif self.IsEther() then
5456
18
55-
elif self = Currency.DAI then
57+
elif self = Currency.LUSD || self = Currency.DAI then
5658
18
5759
else
5860
failwith <| SPrintF1 "Unable to determine decimal places for %A" self
@@ -68,6 +70,7 @@ type Currency =
6870
| LTC -> "LTC"
6971
| ETH -> "ETH"
7072
| ETC -> "ETC"
73+
| LUSD -> "LUSD"
7174
| DAI -> "DAI"
7275
#endif
7376

src/GWallet.Backend/Ether/EtherAccount.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ module internal Account =
224224

225225
let baseCurrency =
226226
match account.Currency with
227-
| DAI -> ETH
227+
| DAI | LUSD -> ETH
228228
| _ -> failwith <| SPrintF1 "Unknown token %A" account.Currency
229229

230230
let! tokenTransferFee = Ether.Server.EstimateTokenTransferFee account amount destination
@@ -467,7 +467,7 @@ module internal Account =
467467
let GetSignedTransactionDetails (signedTransaction: SignedTransaction<'T>): ITransactionDetails =
468468

469469
match signedTransaction.TransactionInfo.Proposal.Amount.Currency with
470-
| DAI ->
470+
| LUSD | DAI ->
471471
// FIXME: derive the transaction details from the raw transaction so that we can remove the proposal from
472472
// the SignedTransaction type (as it's redundant); and when we remove it, we can also rename
473473
// IBlockchainFeeInfo's Currency to "FeeCurrency", or change "Metadata" members whose type is

src/GWallet.Backend/Ether/TokenManager.fs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module TokenManager =
1515
let GetTokenContractAddress currency =
1616
match currency with
1717
| Currency.DAI -> "0x6B175474E89094C44Da98b954EedeAC495271d0F"
18+
| Currency.LUSD -> "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0"
1819
| _ -> raise <| invalidOp (SPrintF1 "%A has no contract address" currency)
1920

2021
type TokenServiceWrapper(web3, currency: Currency) =

src/GWallet.Backend/FiatValueEstimation.fs

+1
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,7 @@ module FiatValueEstimation =
10161016
| Currency.ETC,_ -> "ethereum-classic"
10171017
| Currency.DAI,PriceProvider.CoinCap -> "multi-collateral-dai"
10181018
| Currency.DAI,_ -> "dai"
1019+
| Currency.LUSD,_ -> "liquity-usd"
10191020

10201021
try
10211022
let baseUrl =

src/GWallet.Frontend.XF/FrontendHelpers.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ module FrontendHelpers =
102102
match currency with
103103
| Currency.BTC -> Color.FromRgb(245, 146, 47)
104104

105-
// looks very similar to BTC (orangish)... so let's use SAI color when we phase it out?
106-
| Currency.DAI -> Color.FromRgb(250, 176, 28)
105+
| Currency.DAI -> Color.FromRgb(254, 205, 83)
107106

107+
| Currency.LUSD -> Color.FromRgb(46, 182, 234)
108108
| Currency.ETC -> Color.FromRgb(14, 119, 52)
109109
| Currency.ETH -> Color.FromRgb(130, 131, 132)
110110
| Currency.LTC -> Color.FromRgb(54, 94, 155)

src/GWallet.Frontend.XF/GWallet.Frontend.XF.fsproj

+12
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@
3737
<EmbeddedResource Include="..\..\img\dai_red_120x120.png">
3838
<Link>img\dai_red_120x120.png</Link>
3939
</EmbeddedResource>
40+
<EmbeddedResource Include="..\..\img\lusd_grey_60x60.png">
41+
<Link>img\lusd_grey_60x60.png</Link>
42+
</EmbeddedResource>
43+
<EmbeddedResource Include="..\..\img\lusd_grey_120x120.png">
44+
<Link>img\lusd_grey_120x120.png</Link>
45+
</EmbeddedResource>
46+
<EmbeddedResource Include="..\..\img\lusd_red_60x60.png">
47+
<Link>img\lusd_red_60x60.png</Link>
48+
</EmbeddedResource>
49+
<EmbeddedResource Include="..\..\img\lusd_red_120x120.png">
50+
<Link>img\lusd_red_120x120.png</Link>
51+
</EmbeddedResource>
4052
<EmbeddedResource Include="..\..\img\etc_grey_60x60.png">
4153
<Link>img\etc_grey_60x60.png</Link>
4254
</EmbeddedResource>

0 commit comments

Comments
 (0)