@@ -70,6 +70,7 @@ func (c cost) EstimateTransaction(p EstimationParams, chain Chain) (model.Quote,
70
70
nativeCost *= 1.0 + common .NativeTokenBuffer (chain .ChainID )
71
71
}
72
72
costEth := common .WeiToEther (& p .CostETH )
73
+ // transactionCost is for native token transaction cost (tx_value)
73
74
transactionCost := costEth * nativeCost
74
75
75
76
// Query owlracle for gas
@@ -86,6 +87,8 @@ func (c cost) EstimateTransaction(p EstimationParams, chain Chain) (model.Quote,
86
87
87
88
// Query cost of token in USD if used and apply buffer
88
89
costToken := common .WeiToEther (& p .CostToken )
90
+ // tokenCost in contract call ERC-20 token costs
91
+ // Also for buying tokens directly
89
92
tokenCost , err := c .LookupUSD (p .TokenName , costToken )
90
93
if err != nil {
91
94
return model.Quote {}, common .StringError (err )
@@ -96,7 +99,8 @@ func (c cost) EstimateTransaction(p EstimationParams, chain Chain) (model.Quote,
96
99
97
100
// Compute service fee
98
101
upcharge := chain .StringFee
99
- serviceFee := (transactionCost + gasInUSD + tokenCost ) * upcharge
102
+ baseCheckoutFee := 0.3
103
+ serviceFee := (transactionCost + gasInUSD + tokenCost )* upcharge + baseCheckoutFee
100
104
101
105
// floor
102
106
if transactionCost < 0.01 {
@@ -105,10 +109,6 @@ func (c cost) EstimateTransaction(p EstimationParams, chain Chain) (model.Quote,
105
109
if gasInUSD < 0.01 {
106
110
gasInUSD = 0.01
107
111
}
108
- // if tokenCost < 0.01 { tokenCost = 0.01 }
109
- if serviceFee < 0.01 {
110
- serviceFee = 0.01
111
- }
112
112
113
113
totalUSD := transactionCost + gasInUSD + tokenCost + serviceFee
114
114
0 commit comments