-
Notifications
You must be signed in to change notification settings - Fork 573
Expand file tree
/
Copy pathAction.java
More file actions
50 lines (39 loc) · 1.05 KB
/
Action.java
File metadata and controls
50 lines (39 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.alphawallet.app.entity.lifi;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class Action
{
@SerializedName("fromChainId")
@Expose
public long fromChainId;
@SerializedName("toChainId")
@Expose
public long toChainId;
@SerializedName("fromToken")
@Expose
public LifiToken fromToken;
@SerializedName("toToken")
@Expose
public LifiToken toToken;
@SerializedName("fromAmount")
@Expose
public String fromAmount;
@SerializedName("slippage")
@Expose
public double slippage;
@SerializedName("fromAddress")
@Expose
public String fromAddress;
@SerializedName("toAddress")
@Expose
public String toAddress;
public String getCurrentPrice()
{
return new BigDecimal(fromToken.priceUSD)
.divide(new BigDecimal(toToken.priceUSD), 4, RoundingMode.DOWN)
.stripTrailingZeros()
.toPlainString();
}
}