Files

28 lines
625 B
Go
Raw Permalink Normal View History

2025-06-13 19:52:56 +08:00
package task
import (
"context"
"time"
2025-07-25 11:41:52 +08:00
"github.com/smallnest/chanx"
2025-06-13 19:52:56 +08:00
"github.com/v03413/bepusdt/app/conf"
"github.com/v03413/bepusdt/app/utils"
2025-06-13 19:52:56 +08:00
)
2025-06-15 21:57:46 +08:00
func xlayerInit() {
2025-07-25 11:41:52 +08:00
ctx := context.Background()
xlayer := evm{
2025-10-13 11:27:38 +08:00
Network: conf.Xlayer,
2025-07-25 11:41:52 +08:00
Block: block{
RollDelayOffset: 3,
ConfirmedOffset: 12,
},
Client: utils.NewHttpClient(),
blockScanQueue: chanx.NewUnboundedChan[evmBlock](ctx, 30),
2025-07-25 11:41:52 +08:00
}
2025-10-13 11:27:38 +08:00
Register(Task{Callback: xlayer.blockDispatch})
Register(Task{Callback: xlayer.syncBlocksForward, Duration: time.Second * 3})
2025-10-13 11:27:38 +08:00
Register(Task{Callback: xlayer.tradeConfirmHandle, Duration: time.Second * 5})
2025-06-13 19:52:56 +08:00
}