Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ genmocks:
mockgen -destination=./comm/p2p/mock/conn/conn.go github.com/libp2p/go-libp2p/core/network Conn
mockgen -destination=./comm/p2p/mock/stream/stream.go github.com/libp2p/go-libp2p/core/network Stream,Conn
mockgen -source=./chains/evm/message/across.go -destination=./chains/evm/message/mock/across.go
mockgen -source=./chains/evm/message/rhinestone.go -destination=./chains/evm/message/mock/rhinestone.go
mockgen -source=./chains/evm/message/lifiEscrow.go -destination=./chains/evm/message/mock/lifiEscrow.go
mockgen -source=./chains/evm/message/mayan.go -destination=./chains/evm/message/mock/mayan.go
mockgen -source=./chains/evm/message/confirmations.go -destination=./chains/evm/message/mock/confirmations.go
mockgen -source=./api/handlers/signing.go -destination=./api/handlers/mock/signing.go
mockgen -package mock_message -destination=./chains/evm/message/mock/pricing.go github.com/sprintertech/lifi-solver/pkg/pricing OrderPricer
Expand Down
32 changes: 0 additions & 32 deletions api/handlers/signing.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ type ProtocolType string

const (
AcrossProtocol ProtocolType = "across"
MayanProtocol ProtocolType = "mayan"
RhinestoneProtocol ProtocolType = "rhinestone"
LifiEscrowProtocol ProtocolType = "lifi-escrow"
LighterProtocol ProtocolType = "lighter"
SprinterCreditProtocol ProtocolType = "sprinter-credit"
Expand Down Expand Up @@ -91,36 +89,6 @@ func (h *SigningHandler) HandleSigning(w http.ResponseWriter, r *http.Request) {
RepaymentChainID: b.RepaymentChainId,
})
}
case MayanProtocol:
{
m = evmMessage.NewMayanMessage(0, b.ChainId, &evmMessage.MayanData{
OrderHash: b.DepositId,
Nonce: b.Nonce.Int,
LiquidityPool: common.HexToAddress(b.LiquidityPool),
Caller: common.HexToAddress(b.Caller),
ErrChn: errChn,
Calldata: b.Calldata,
DepositTxHash: b.DepositTxHash,
Source: 0,
Destination: b.ChainId,
Deadline: b.Deadline,
BorrowAmount: b.BorrowAmount.Int,
})
}
case RhinestoneProtocol:
{
m = evmMessage.NewRhinestoneMessage(0, b.ChainId, &evmMessage.RhinestoneData{
BundleID: b.DepositId,
Nonce: b.Nonce.Int,
LiquidityPool: common.HexToAddress(b.LiquidityPool),
Caller: common.HexToAddress(b.Caller),
ErrChn: errChn,
Source: 0,
Destination: b.ChainId,
Deadline: b.Deadline,
BorrowAmount: b.BorrowAmount.Int,
})
}
case LifiEscrowProtocol:
{
m = evmMessage.NewLifiEscrowMessage(0, b.ChainId, &evmMessage.LifiEscrowData{
Expand Down
72 changes: 0 additions & 72 deletions api/handlers/signing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,78 +299,6 @@ func (s *SigningHandlerTestSuite) Test_HandleSigning_AcrossSuccess() {
s.Equal(http.StatusAccepted, recorder.Code)
}

func (s *SigningHandlerTestSuite) Test_HandleSigning_MayanSuccess() {
msgChn := make(chan []*message.Message)
handler := handlers.NewSigningHandler(msgChn, s.chains)

input := handlers.SigningBody{
DepositId: "1000",
Protocol: "mayan",
LiquidityPool: "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657",
Caller: "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657",
Calldata: "0xbe5",
Nonce: &handlers.BigInt{big.NewInt(1001)},
BorrowAmount: &handlers.BigInt{big.NewInt(1000)},
//nolint:gosec
Deadline: uint64(time.Now().Unix()),
}
body, _ := json.Marshal(input)

req := httptest.NewRequest(http.MethodPost, "/v1/chains/1/signatures", bytes.NewReader(body))
req = mux.SetURLVars(req, map[string]string{
"chainId": "1",
})
req.Header.Set("Content-Type", "application/json")

recorder := httptest.NewRecorder()

go func() {
msg := <-msgChn
ad := msg[0].Data.(*across.MayanData)
ad.ErrChn <- nil
}()

handler.HandleSigning(recorder, req)

s.Equal(http.StatusAccepted, recorder.Code)
}

func (s *SigningHandlerTestSuite) Test_HandleSigning_RhinestoneSuccess() {
msgChn := make(chan []*message.Message)
handler := handlers.NewSigningHandler(msgChn, s.chains)

input := handlers.SigningBody{
DepositId: "depositID",
Protocol: "rhinestone",
LiquidityPool: "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657",
Caller: "0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657",
Calldata: "0xbe5",
Nonce: &handlers.BigInt{big.NewInt(1001)},
BorrowAmount: &handlers.BigInt{big.NewInt(1000)},
//nolint:gosec
Deadline: uint64(time.Now().Unix()),
}
body, _ := json.Marshal(input)

req := httptest.NewRequest(http.MethodPost, "/v1/chains/1/signatures", bytes.NewReader(body))
req = mux.SetURLVars(req, map[string]string{
"chainId": "1",
})
req.Header.Set("Content-Type", "application/json")

recorder := httptest.NewRecorder()

go func() {
msg := <-msgChn
ad := msg[0].Data.(*across.RhinestoneData)
ad.ErrChn <- nil
}()

handler.HandleSigning(recorder, req)

s.Equal(http.StatusAccepted, recorder.Code)
}

func (s *SigningHandlerTestSuite) Test_HandleSigning_LifiSuccess() {
msgChn := make(chan []*message.Message)
handler := handlers.NewSigningHandler(msgChn, s.chains)
Expand Down
31 changes: 0 additions & 31 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import (
"github.com/sprintertech/sprinter-signing/protocol/across"
"github.com/sprintertech/sprinter-signing/protocol/lifi"
lighterAPI "github.com/sprintertech/sprinter-signing/protocol/lighter"
"github.com/sprintertech/sprinter-signing/protocol/mayan"
"github.com/sprintertech/sprinter-signing/topology"
"github.com/sprintertech/sprinter-signing/tss"
coreEvm "github.com/sygmaprotocol/sygma-core/chains/evm"
Expand Down Expand Up @@ -170,7 +169,6 @@ func Run() error {

var hubPoolContract across.TokenMatcher
acrossPools := make(map[uint64]common.Address)
mayanPools := make(map[uint64]common.Address)
lifiOutputSettlers := make(map[uint64]common.Address)
repayerAddresses := make(map[uint64]common.Address)
tokens := make(map[uint64]map[string]config.TokenConfig)
Expand All @@ -189,11 +187,6 @@ func Run() error {
acrossPools[*c.GeneralChainConfig.Id] = poolAddress
}

if c.MayanSwift != "" {
poolAddress := common.HexToAddress(c.MayanSwift)
mayanPools[*c.GeneralChainConfig.Id] = poolAddress
}

if c.LifiOutputSettler != "" {
settlerAddress := common.HexToAddress(c.LifiOutputSettler)
lifiOutputSettlers[*c.GeneralChainConfig.Id] = settlerAddress
Expand Down Expand Up @@ -269,30 +262,6 @@ func Run() error {
confirmationsPerChain[*c.GeneralChainConfig.Id] = c.ConfirmationsByValue
}

if c.MayanSwift != "" {
mayanSwiftContract := contracts.NewMayanSwiftContract(client, common.HexToAddress(c.MayanSwift))
mayanApi := mayan.NewMayanExplorer()
mayanMh := evmMessage.NewMayanMessageHandler(
*c.GeneralChainConfig.Id,
client,
repayerAddresses,
mayanPools,
coordinator,
host,
communication,
keyshareStore,
watcher,
tokenStore,
mayanSwiftContract,
mayanApi,
sigChn)
go mayanMh.Listen(ctx)

mh.RegisterMessageHandler(message.MessageType(comm.MayanMsg.String()), mayanMh)
supportedChains[*c.GeneralChainConfig.Id] = struct{}{}
confirmationsPerChain[*c.GeneralChainConfig.Id] = c.ConfirmationsByValue
}

if c.LifiOutputSettler != "" {
usdPricer := pyth.NewClient(ctx)
err = usdPricer.Start(ctx)
Expand Down
Loading
Loading