Skip to content

Commit

Permalink
Backend,Frontend: introduce LUSD currency
Browse files Browse the repository at this point in the history
Added LUSD value to Currency enum and made relevant code
changes. Also added icons for LUSD.
  • Loading branch information
webwarrior-ws committed Jul 22, 2024
1 parent 75619d5 commit b20d5fd
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 8 deletions.
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.
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.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.DAI | Currency.LUSD ->
"https://etherscan.io/tx/"
Uri(baseUrl + txHash)
7 changes: 5 additions & 2 deletions src/GWallet.Backend/Currency.fs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type Currency =
| ETH
| ETC
| DAI
| LUSD
// </NOTE>

#if STRICTER_COMPILATION_BUT_WITH_REFLECTION_AT_RUNTIME
Expand All @@ -32,6 +33,7 @@ type Currency =
yield ETH
yield ETC
yield DAI
yield LUSD
}
#endif

Expand All @@ -41,7 +43,7 @@ type Currency =
member self.IsEther() =
self = Currency.ETC || self = Currency.ETH
member self.IsEthToken() =
self = Currency.DAI
self = Currency.DAI || self = Currency.LUSD
member self.IsEtherBased() =
self.IsEther() || self.IsEthToken()
member self.IsUtxo() =
Expand All @@ -52,7 +54,7 @@ type Currency =
8
elif self.IsEther() then
18
elif self = Currency.DAI then
elif self = Currency.LUSD || self = Currency.DAI then
18
else
failwith <| SPrintF1 "Unable to determine decimal places for %A" self
Expand All @@ -68,6 +70,7 @@ type Currency =
| LTC -> "LTC"
| ETH -> "ETH"
| ETC -> "ETC"
| LUSD -> "LUSD"
| DAI -> "DAI"
#endif

Expand Down
4 changes: 2 additions & 2 deletions src/GWallet.Backend/Ether/EtherAccount.fs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ module internal Account =

let baseCurrency =
match account.Currency with
| DAI -> ETH
| DAI | LUSD -> ETH
| _ -> failwith <| SPrintF1 "Unknown token %A" account.Currency

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

match signedTransaction.TransactionInfo.Proposal.Amount.Currency with
| DAI ->
| LUSD | DAI ->
// FIXME: derive the transaction details from the raw transaction so that we can remove the proposal from
// the SignedTransaction type (as it's redundant); and when we remove it, we can also rename
// IBlockchainFeeInfo's Currency to "FeeCurrency", or change "Metadata" members whose type is
Expand Down
1 change: 1 addition & 0 deletions src/GWallet.Backend/Ether/TokenManager.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module TokenManager =
let GetTokenContractAddress currency =
match currency with
| Currency.DAI -> "0x6B175474E89094C44Da98b954EedeAC495271d0F"
| Currency.LUSD -> "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0"
| _ -> raise <| invalidOp (SPrintF1 "%A has no contract address" currency)

type TokenServiceWrapper(web3, currency: Currency) =
Expand Down
1 change: 1 addition & 0 deletions src/GWallet.Backend/FiatValueEstimation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ module FiatValueEstimation =
| Currency.ETC,_ -> "ethereum-classic"
| Currency.DAI,PriceProvider.CoinCap -> "multi-collateral-dai"
| Currency.DAI,_ -> "dai"
| Currency.LUSD,_ -> "liquity-usd"

try
let baseUrl =
Expand Down
4 changes: 2 additions & 2 deletions src/GWallet.Frontend.XF/FrontendHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ module FrontendHelpers =
match currency with
| Currency.BTC -> Color.FromRgb(245, 146, 47)

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

| Currency.LUSD -> Color.FromRgb(46, 182, 234)
| Currency.ETC -> Color.FromRgb(14, 119, 52)
| Currency.ETH -> Color.FromRgb(130, 131, 132)
| Currency.LTC -> Color.FromRgb(54, 94, 155)
Expand Down
12 changes: 12 additions & 0 deletions src/GWallet.Frontend.XF/GWallet.Frontend.XF.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@
<EmbeddedResource Include="..\..\img\dai_red_120x120.png">
<Link>img\dai_red_120x120.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\..\img\lusd_grey_60x60.png">
<Link>img\lusd_grey_60x60.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\..\img\lusd_grey_120x120.png">
<Link>img\lusd_grey_120x120.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\..\img\lusd_red_60x60.png">
<Link>img\lusd_red_60x60.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\..\img\lusd_red_120x120.png">
<Link>img\lusd_red_120x120.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\..\img\etc_grey_60x60.png">
<Link>img\etc_grey_60x60.png</Link>
</EmbeddedResource>
Expand Down

0 comments on commit b20d5fd

Please sign in to comment.