Skip to content

Commit f7e6f2d

Browse files
committed
fix: remove lighter fee
1 parent da6b5c3 commit f7e6f2d

File tree

2 files changed

+1
-50
lines changed

2 files changed

+1
-50
lines changed

chains/lighter/message/lighter.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525

2626
var (
2727
ARBITRUM_CHAIN_ID = big.NewInt(42161)
28-
FEE = big.NewInt(2000000)
2928
USDC_ACCOUNT_INDEX = 3
3029
)
3130

@@ -150,20 +149,15 @@ func (h *LighterMessageHandler) verifyWithdrawal(tx *lighter.LighterTx) error {
150149
return errors.New("only usdc asset supported on lighter")
151150
}
152151

153-
if tx.Transfer.Amount <= FEE.Uint64() {
154-
return errors.New("fee higher than withdrawal amount")
155-
}
156-
157152
return nil
158153
}
159154

160155
func (h *LighterMessageHandler) calldata(tx *lighter.LighterTx) ([]byte, error) {
161-
borrowAmount := new(big.Int).Sub(new(big.Int).SetUint64(tx.Transfer.Amount), FEE)
162156
return consts.LighterABI.Pack(
163157
"fulfillWithdraw",
164158
common.HexToHash(tx.Hash),
165159
common.BytesToAddress(tx.Transfer.Memo[:20]),
166-
borrowAmount)
160+
new(big.Int).SetUint64(tx.Transfer.Amount))
167161
}
168162

169163
func (h *LighterMessageHandler) Listen(ctx context.Context) {

chains/lighter/message/lighter_test.go

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -112,49 +112,6 @@ func (s *LighterMessageHandlerTestSuite) Test_HandleMessage_ValidMessage() {
112112
s.Nil(err)
113113
}
114114

115-
func (s *LighterMessageHandlerTestSuite) Test_HandleMessage_FeeHigherThanAmount() {
116-
s.mockCommunication.EXPECT().Broadcast(
117-
gomock.Any(),
118-
gomock.Any(),
119-
comm.LighterMsg,
120-
"lighter",
121-
).Return(nil)
122-
p, _ := pstoremem.NewPeerstore()
123-
s.mockHost.EXPECT().Peerstore().Return(p)
124-
125-
errChn := make(chan error, 1)
126-
ad := &message.LighterData{
127-
ErrChn: errChn,
128-
Nonce: big.NewInt(101),
129-
LiquidityPool: common.HexToAddress("0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657"),
130-
OrderHash: "orderHash",
131-
DepositTxHash: "orderHash",
132-
}
133-
134-
s.mockTxFetcher.EXPECT().GetTx(ad.OrderHash).Return(&lighter.LighterTx{
135-
Type: lighter.TxTypeL2Transfer,
136-
Transfer: &lighter.Transfer{
137-
Amount: 2000000,
138-
AssetIndex: 3,
139-
ToAccountIndex: 3,
140-
Memo: []byte{238, 123, 250, 212, 202, 237, 62, 98, 106, 248, 169, 199, 213, 3, 76, 213, 137, 238, 73, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
141-
},
142-
}, nil)
143-
144-
m := &coreMessage.Message{
145-
Data: ad,
146-
Source: 0,
147-
Destination: 10,
148-
}
149-
prop, err := s.handler.HandleMessage(m)
150-
151-
s.Nil(prop)
152-
s.NotNil(err)
153-
154-
err = <-errChn
155-
s.NotNil(err)
156-
}
157-
158115
func (s *LighterMessageHandlerTestSuite) Test_HandleMessage_InvalidTxType() {
159116
s.mockCommunication.EXPECT().Broadcast(
160117
gomock.Any(),

0 commit comments

Comments
 (0)