Skip to content

Commit 8bae94a

Browse files
authored
Merge pull request #78 from String-xyz/task/sean/priceFloor
Update service fee floor to $0.30
2 parents db764f1 + d06738d commit 8bae94a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pkg/service/chain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type Chain struct {
1919

2020
// TODO: should we store this in a DB or determine it dynamically??? Previously this was defined in the preprocessor in the Chain array
2121
func stringFee(chainId uint64) (float64, error) {
22-
return 0.05, nil
22+
return 0.03, nil
2323
}
2424

2525
func ChainInfo(chainId uint64, networkRepo repository.Network, assetRepo repository.Asset) (Chain, error) {

pkg/service/cost.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ func (c cost) EstimateTransaction(p EstimationParams, chain Chain) (model.Quote,
7070
nativeCost *= 1.0 + common.NativeTokenBuffer(chain.ChainID)
7171
}
7272
costEth := common.WeiToEther(&p.CostETH)
73+
// transactionCost is for native token transaction cost (tx_value)
7374
transactionCost := costEth * nativeCost
7475

7576
// Query owlracle for gas
@@ -86,6 +87,8 @@ func (c cost) EstimateTransaction(p EstimationParams, chain Chain) (model.Quote,
8687

8788
// Query cost of token in USD if used and apply buffer
8889
costToken := common.WeiToEther(&p.CostToken)
90+
// tokenCost in contract call ERC-20 token costs
91+
// Also for buying tokens directly
8992
tokenCost, err := c.LookupUSD(p.TokenName, costToken)
9093
if err != nil {
9194
return model.Quote{}, common.StringError(err)
@@ -96,7 +99,8 @@ func (c cost) EstimateTransaction(p EstimationParams, chain Chain) (model.Quote,
9699

97100
// Compute service fee
98101
upcharge := chain.StringFee
99-
serviceFee := (transactionCost + gasInUSD + tokenCost) * upcharge
102+
baseCheckoutFee := 0.3
103+
serviceFee := (transactionCost+gasInUSD+tokenCost)*upcharge + baseCheckoutFee
100104

101105
// floor
102106
if transactionCost < 0.01 {
@@ -105,10 +109,6 @@ func (c cost) EstimateTransaction(p EstimationParams, chain Chain) (model.Quote,
105109
if gasInUSD < 0.01 {
106110
gasInUSD = 0.01
107111
}
108-
// if tokenCost < 0.01 { tokenCost = 0.01 }
109-
if serviceFee < 0.01 {
110-
serviceFee = 0.01
111-
}
112112

113113
totalUSD := transactionCost + gasInUSD + tokenCost + serviceFee
114114

0 commit comments

Comments
 (0)