@@ -18,6 +18,11 @@ import (
1818 "github.com/libp2p/go-libp2p/core/crypto"
1919 "github.com/rs/zerolog/log"
2020 "github.com/spf13/viper"
21+ "github.com/sprintertech/lifi-solver/pkg/pricing"
22+ lifiTypes "github.com/sprintertech/lifi-solver/pkg/protocols/lifi"
23+ "github.com/sprintertech/lifi-solver/pkg/protocols/lifi/validation"
24+ "github.com/sprintertech/lifi-solver/pkg/token"
25+ "github.com/sprintertech/lifi-solver/pkg/tokenpricing/pyth"
2126 solverConfig "github.com/sprintertech/solver-config/go/config"
2227 "github.com/sprintertech/sprinter-signing/api"
2328 "github.com/sprintertech/sprinter-signing/api/handlers"
@@ -36,6 +41,7 @@ import (
3641 "github.com/sprintertech/sprinter-signing/metrics"
3742 "github.com/sprintertech/sprinter-signing/price"
3843 "github.com/sprintertech/sprinter-signing/protocol/across"
44+ "github.com/sprintertech/sprinter-signing/protocol/lifi"
3945 "github.com/sprintertech/sprinter-signing/protocol/mayan"
4046 "github.com/sprintertech/sprinter-signing/topology"
4147 "github.com/sprintertech/sprinter-signing/tss"
@@ -153,6 +159,7 @@ func Run() error {
153159 var hubPoolContract across.TokenMatcher
154160 acrossPools := make (map [uint64 ]common.Address )
155161 mayanPools := make (map [uint64 ]common.Address )
162+ lifiOutputSettlers := make (map [uint64 ]common.Address )
156163 repayerAddresses := make (map [uint64 ]common.Address )
157164 tokens := make (map [uint64 ]map [string ]config.TokenConfig )
158165 for _ , chainConfig := range configuration .ChainConfigs {
@@ -175,6 +182,11 @@ func Run() error {
175182 mayanPools [* c .GeneralChainConfig .Id ] = poolAddress
176183 }
177184
185+ if c .LifiOutputSettler != "" {
186+ settlerAddress := common .HexToAddress (c .LifiOutputSettler )
187+ lifiOutputSettlers [* c .GeneralChainConfig .Id ] = settlerAddress
188+ }
189+
178190 if c .AcrossHubPool != "" {
179191 hubPoolAddress := common .HexToAddress (c .AcrossHubPool )
180192 hubPoolContract = contracts .NewHubPoolContract (client , hubPoolAddress , c .Tokens )
@@ -269,6 +281,32 @@ func Run() error {
269281 confirmationsPerChain [* c .GeneralChainConfig .Id ] = c .ConfirmationsByValue
270282 }
271283
284+ if c .LifiOutputSettler != "" {
285+ usdPricer := pyth .NewClient (ctx )
286+ resolver := token .NewTokenResolver (solverConfig , usdPricer )
287+ orderPricer := pricing .NewStandardPricer (resolver )
288+ lifiApi := lifi .NewLifiAPI ()
289+ lifiValidator := validation .NewLifiEscrowOrderValidator [lifiTypes.LifiOrder ](solverConfig , orderPricer )
290+
291+ lifiMh := evmMessage .NewLifiEscrowMessageHandler (
292+ * c .GeneralChainConfig .Id ,
293+ lifiOutputSettlers ,
294+ coordinator ,
295+ host ,
296+ communication ,
297+ keyshareStore ,
298+ watcher ,
299+ tokenStore ,
300+ lifiApi ,
301+ orderPricer ,
302+ lifiValidator ,
303+ sigChn ,
304+ )
305+ mh .RegisterMessageHandler (evmMessage .LifiEscrowMessage , lifiMh )
306+ supportedChains [* c .GeneralChainConfig .Id ] = struct {}{}
307+ confirmationsPerChain [* c .GeneralChainConfig .Id ] = c .ConfirmationsByValue
308+ }
309+
272310 lifiUnlockMh := evmMessage .NewLifiUnlockHandler (
273311 * c .GeneralChainConfig .Id ,
274312 repayerAddresses ,
0 commit comments