66 "errors"
77 "fmt"
88 "math/big"
9+ "strconv"
910 "time"
1011
1112 "github.com/ethereum/go-ethereum/common"
@@ -23,9 +24,8 @@ import (
2324)
2425
2526var (
26- ARBITRUM_CHAIN_ID = big .NewInt (42161 )
27- FILL_DEADLINE = time .Minute * 5
28- WITHDRAWAL_ACCOUNT_INDEX uint64 = 3
27+ ARBITRUM_CHAIN_ID = big .NewInt (42161 )
28+ FILL_DEADLINE = time .Minute * 5
2929)
3030
3131type Coordinator interface {
@@ -43,14 +43,16 @@ type LighterMessageHandler struct {
4343 fetcher signing.SaveDataFetcher
4444 sigChn chan any
4545
46- lighterAddress common.Address
47- usdcAddress common.Address
48- txFetcher TxFetcher
46+ lighterAddress common.Address
47+ usdcAddress common.Address
48+ repaymentAccount string
49+ txFetcher TxFetcher
4950}
5051
5152func NewLighterMessageHandler (
5253 lighterAddress common.Address ,
5354 usdcAddress common.Address ,
55+ repaymentAccount string ,
5456 txFetcher TxFetcher ,
5557 coordinator Coordinator ,
5658 host host.Host ,
@@ -59,14 +61,15 @@ func NewLighterMessageHandler(
5961 sigChn chan any ,
6062) * LighterMessageHandler {
6163 return & LighterMessageHandler {
62- txFetcher : txFetcher ,
63- usdcAddress : usdcAddress ,
64- lighterAddress : lighterAddress ,
65- coordinator : coordinator ,
66- host : host ,
67- comm : comm ,
68- fetcher : fetcher ,
69- sigChn : sigChn ,
64+ txFetcher : txFetcher ,
65+ usdcAddress : usdcAddress ,
66+ repaymentAccount : repaymentAccount ,
67+ lighterAddress : lighterAddress ,
68+ coordinator : coordinator ,
69+ host : host ,
70+ comm : comm ,
71+ fetcher : fetcher ,
72+ sigChn : sigChn ,
7073 }
7174}
7275
@@ -139,7 +142,7 @@ func (h *LighterMessageHandler) verifyWithdrawal(tx *lighter.LighterTx, borrowAm
139142 return errors .New ("invalid transaction type" )
140143 }
141144
142- if tx .Transfer .ToAccountIndex != WITHDRAWAL_ACCOUNT_INDEX {
145+ if strconv . Itoa ( tx .Transfer .ToAccountIndex ) != h . repaymentAccount {
143146 return errors .New ("transfer account index invalid" )
144147 }
145148
0 commit comments