@@ -90,21 +90,21 @@ func (h *LighterMessageHandler) HandleMessage(m *message.Message) (*proposal.Pro
9090 return nil , err
9191 }
9292
93- if err = h .verifyWithdrawal (tx , data . BorrowAmount ); err != nil {
93+ if err = h .verifyWithdrawal (tx ); err != nil {
9494 data .ErrChn <- err
9595 return nil , err
9696 }
9797
9898 data .ErrChn <- nil
9999
100- calldata , err := h .calldata (tx , data . BorrowAmount )
100+ calldata , err := h .calldata (tx )
101101 if err != nil {
102102 return nil , err
103103 }
104104
105105 unlockHash , err := signature .BorrowUnlockHash (
106106 calldata ,
107- data . BorrowAmount ,
107+ new (big. Int ). SetUint64 ( tx . Transfer . USDCAmount ) ,
108108 h .usdcAddress ,
109109 ARBITRUM_CHAIN_ID ,
110110 h .lighterAddress ,
@@ -137,7 +137,7 @@ func (h *LighterMessageHandler) HandleMessage(m *message.Message) (*proposal.Pro
137137 return nil , nil
138138}
139139
140- func (h * LighterMessageHandler ) verifyWithdrawal (tx * lighter.LighterTx , borrowAmount * big. Int ) error {
140+ func (h * LighterMessageHandler ) verifyWithdrawal (tx * lighter.LighterTx ) error {
141141 if tx .Type != lighter .TxTypeL2Transfer {
142142 return errors .New ("invalid transaction type" )
143143 }
@@ -146,19 +146,15 @@ func (h *LighterMessageHandler) verifyWithdrawal(tx *lighter.LighterTx, borrowAm
146146 return errors .New ("transfer account index invalid" )
147147 }
148148
149- if borrowAmount .Cmp (new (big.Int ).SetUint64 (tx .Transfer .USDCAmount )) != - 1 {
150- return errors .New ("borrow amount exceeds withdrawal value" )
151- }
152-
153149 return nil
154150}
155151
156- func (h * LighterMessageHandler ) calldata (tx * lighter.LighterTx , borrowAmount * big. Int ) ([]byte , error ) {
152+ func (h * LighterMessageHandler ) calldata (tx * lighter.LighterTx ) ([]byte , error ) {
157153 return consts .LighterABI .Pack (
158154 "withdraw" ,
159155 common .HexToHash (tx .Hash ),
160156 common .HexToAddress (tx .L1Address ),
161- borrowAmount )
157+ new (big. Int ). SetUint64 ( tx . Transfer . USDCAmount ) )
162158}
163159
164160func (h * LighterMessageHandler ) Listen (ctx context.Context ) {
0 commit comments