Compare commits
27
Commits
tron-grid
...
block-scan
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f99c025692 | ||
|
|
8c8f364e87 | ||
|
|
463c802ea9 | ||
|
|
51305cb6e8 | ||
|
|
2e67bbe531 | ||
|
|
e464ae6572 | ||
|
|
cc859662f9 | ||
|
|
ca7817306e | ||
|
|
679b46db1a | ||
|
|
da514ae9f6 | ||
|
|
938f659ee1 | ||
|
|
17438708da | ||
|
|
d30fa01865 | ||
|
|
350ff3f25a | ||
|
|
1d70ded4f0 | ||
|
|
904a38f703 | ||
|
|
eb057e9ee4 | ||
|
|
bac9052264 | ||
|
|
407fad6e75 | ||
|
|
4fb39a0560 | ||
|
|
7da251dbb0 | ||
|
|
6bef5060c1 | ||
|
|
e0a429eb85 | ||
|
|
af3bddd84b | ||
|
|
d49a296c25 | ||
|
|
a6d0d1893c | ||
|
|
6eb9756399 |
@@ -14,7 +14,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [ linux ]
|
||||
goarch: [ amd64 ]
|
||||
goarch: [ amd64,arm64 ]
|
||||
fail-fast: false
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
@@ -40,9 +40,9 @@ jobs:
|
||||
run: go mod download
|
||||
- name: Build Bepusdt
|
||||
run: |
|
||||
CGO_ENABLED=1
|
||||
export CGO_ENABLED=0
|
||||
mkdir -p ${{ env.BUILD_DIR }}
|
||||
go build -v -o ${{ env.BUILD_DIR }}/${{ env.APP_NAME }} -trimpath -ldflags "-linkmode external -extldflags -static -s -w -buildid=" ./main
|
||||
go build -v -o ${{ env.BUILD_DIR }}/${{ env.APP_NAME }} -trimpath -ldflags "-s -w -buildid=" ./main
|
||||
- name: Prepare package
|
||||
run: |
|
||||
cp -v -R ./templates ./${{ env.BUILD_DIR }}
|
||||
|
||||
+3
-3
@@ -1,14 +1,14 @@
|
||||
FROM golang:1.22.2 AS builder
|
||||
FROM golang:1.23.1 AS builder
|
||||
|
||||
ENV GO111MODULE=on
|
||||
WORKDIR /go/release
|
||||
ADD . .
|
||||
RUN set -x \
|
||||
&& CGO_ENABLED=1 go build -trimpath -ldflags="-linkmode external -extldflags -static -s -w -buildid=" -o bepusdt ./main
|
||||
&& CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -buildid=" -o bepusdt ./main
|
||||
|
||||
FROM debian:latest
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV DEBCONF_NOWARNINGS="yes"
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<a href="https://golang.org"><img src="https://img.shields.io/badge/Golang-1.22-red" alt="Go version 1.21"></a>
|
||||
<a href="https://github.com/gin-gonic/gin"><img src="https://img.shields.io/badge/Gin-v1.9-blue" alt="Gin Web Framework v1.9"></a>
|
||||
<a href="https://github.com/go-telegram-bot-api/telegram-bot-api"><img src="https://img.shields.io/badge/Telegram Bot-v5-lightgrey" alt="Golang Telegram Bot Api-v5"></a>
|
||||
<a href="https://github.com/v03413/bepusdt"><img src="https://img.shields.io/badge/Release-v1.7.16-green" alt="Release v1.7.16"></a>
|
||||
<a href="https://github.com/v03413/bepusdt"><img src="https://img.shields.io/badge/Release-v1.9.21-green" alt="Release v1.9.21"></a>
|
||||
</p>
|
||||
|
||||
## 🪧 介绍
|
||||
@@ -25,6 +25,10 @@
|
||||
- ✅ 机器人支持查询当前实时汇率,计算实际浮动汇率
|
||||
- ✅ 机器人支持任意地址查询 USDT、TRX余额等信息
|
||||
- ✅ 订单收款成功和余额变动通知 支持指定群组推送
|
||||
- ✅ 支持可自定义USDT支付数额的精度,递增颗粒度
|
||||
- ⭕️ 待实现:原生支持易支付对接,不依赖额外插件
|
||||
- ⭕️ 待实现:底层直接采用区块扫描,不依赖三方API
|
||||
- ⭕️ 待实现:支持更多监控通知,如TRX交易 能量变动等
|
||||
|
||||
## 🛠 参数配置
|
||||
|
||||
@@ -32,21 +36,21 @@ Bepusdt 所有参数都是以传递环境变量的方式进行配置,大部分
|
||||
|
||||
### 参数列表
|
||||
|
||||
| 参数名称 | 默认值 | 用法说明 |
|
||||
|--------------------|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| EXPIRE_TIME | `600` | 订单有效期,单位秒 |
|
||||
| USDT_RATE | 空 | USDT汇率,默认留空则获取Okx交易所的汇率(每分钟同步一次),支持多种写法,如:`7.4` 表示固定7.4、`~1.02`表示最新汇率上浮2%、`~0.97`表示最新汇率下浮3%、`+0.3`表示最新加0.3、`-0.2`表示最新减0.2,以此类推;如参数错误则使用固定值6.4 |
|
||||
| AUTH_TOKEN | `123234` | 认证Token,对接会用到这个参数 |
|
||||
| LISTEN | `:8080` | 服务器HTTP监听地址 |
|
||||
| TRADE_IS_CONFIRMED | `0` | 是否需要网络确认,禁用可以提高回调速度,启用则可以防止交易失败 |
|
||||
| APP_URI | 空 | 应用访问地址,留空则系统自动获取,前端收银台会用到,建议设置,例如:https://token-pay.example.com |
|
||||
| WALLET_ADDRESS | 空 | 启动时需要添加的钱包地址,多个请用半角符逗号`,`分开;当然,同样也支持通过机器人添加。 |
|
||||
| TG_BOT_TOKEN | 无 | Telegram Bot Token,**必须设置**,否则无法使用 |
|
||||
| TG_BOT_ADMIN_ID | 无 | Telegram Bot 管理员ID,**必须设置**,否则无法使用 |
|
||||
| TG_BOT_GROUP_ID | 无 | Telegram 群组ID,设置之后机器人会将交易消息会推送到此群 |
|
||||
| TRON_SERVER_API | `TRON_SCAN` | 可选`TRON_SCAN`,`TRON_GRID`,推荐`TRON_GRID`和`TRON_GRID_API_KEY`搭配使用,*更准更强更及时* |
|
||||
| TRON_SCAN_API_KEY | 无 | TRONSCAN API KEY,如果收款地址较多推荐设置,可避免被官方QOS |
|
||||
| TRON_GRID_API_KEY | 无 | TRONGRID API KEY,如果收款地址较多推荐设置,可避免被官方QOS |
|
||||
| 参数名称 | 默认值 | 用法说明 |
|
||||
|----------------------|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| EXPIRE_TIME | `600` | 订单有效期,单位秒 |
|
||||
| USDT_RATE | 空 | USDT汇率,默认留空则获取Okx交易所的汇率(每分钟同步一次),支持多种写法,如:`7.4` 表示固定7.4、`~1.02`表示最新汇率上浮2%、`~0.97`表示最新汇率下浮3%、`+0.3`表示最新加0.3、`-0.2`表示最新减0.2,以此类推;如参数错误则使用固定值6.4 |
|
||||
| USDT_ATOM | `0.01` | `0.01`表示支付数额保留两位小数,相同金额时递增颗粒度为`0.01`,依次类推,如无特殊需求不建议修改。 |
|
||||
| AUTH_TOKEN | `123234` | 认证Token,对接会用到这个参数 |
|
||||
| LISTEN | `:8080` | 服务器HTTP监听地址 |
|
||||
| TRADE_IS_CONFIRMED | `0` | 是否需要网络确认,禁用可以提高回调速度,启用则可以防止交易失败 |
|
||||
| APP_URI | 空 | 应用访问地址,留空则系统自动获取,前端收银台会用到,建议设置,例如:https://token-pay.example.com |
|
||||
| WALLET_ADDRESS | 空 | 启动时需要添加的钱包地址,多个请用半角符逗号`,`分开;当然,同样也支持通过机器人添加。 |
|
||||
| TG_BOT_TOKEN | 无 | Telegram Bot Token,**必须设置**,否则无法使用 |
|
||||
| TG_BOT_ADMIN_ID | 无 | Telegram Bot 管理员ID,**必须设置**,否则无法使用 |
|
||||
| TG_BOT_GROUP_ID | 无 | Telegram 群组ID,设置之后机器人会将交易消息会推送到此群 |
|
||||
| PAYMENT_AMOUNT_RANGE | `0.01,99999` | 支付监控的允许数额范围(闭区间),设置合理数值可避免一些诱导式诈骗交易提醒 |
|
||||
| TRON_GRPC_NODE | `18.141.79.38:50051` | Tron区块网络的GRPC节点,可选列表:https://developers.tron.network/docs/networks#public-node |
|
||||
|
||||
**Ps:所以综上所述,必须设置的参数有`TG_BOT_TOKEN TG_BOT_ADMIN_ID`,否则无法使用!**
|
||||
|
||||
|
||||
+85
-38
@@ -2,7 +2,9 @@ package config
|
||||
|
||||
import (
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/v03413/bepusdt/app/help"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
@@ -15,8 +17,10 @@ const defaultExpireTime = 600 // 订单默认有效期 10分钟
|
||||
const defaultUsdtRate = 6.4 // 默认汇率
|
||||
const defaultAuthToken = "123234" // 默认授权码
|
||||
const defaultListen = ":8080" // 默认监听地址
|
||||
const TronServerApiScan = "TRON_SCAN"
|
||||
const TronServerApiGrid = "TRON_GRID"
|
||||
const defaultPaymentMinAmount = 0.01
|
||||
const defaultPaymentMaxAmount = 99999
|
||||
const defaultAtomicity = "0.01" // 原子精度
|
||||
const defaultTronGrpcNode = "18.141.79.38:50051" // 默认GRPC节点
|
||||
|
||||
var runPath string
|
||||
|
||||
@@ -30,6 +34,85 @@ func init() {
|
||||
runPath = filepath.Dir(execPath)
|
||||
}
|
||||
|
||||
func GetTronGrpcNode() string {
|
||||
if data := help.GetEnv("TRON_GRPC_NODE"); data != "" {
|
||||
|
||||
return strings.TrimSpace(data)
|
||||
}
|
||||
|
||||
return defaultTronGrpcNode
|
||||
}
|
||||
|
||||
func GetAtomicity() (decimal.Decimal, int) {
|
||||
var _defaultAtom, _ = decimal.NewFromString(defaultAtomicity)
|
||||
var _defaultExp = cast.ToInt(math.Abs(float64(_defaultAtom.Exponent())))
|
||||
if data := help.GetEnv("USDT_ATOM"); data != "" {
|
||||
var _atom, err = decimal.NewFromString(data)
|
||||
if err != nil {
|
||||
|
||||
return _defaultAtom, _defaultExp
|
||||
}
|
||||
|
||||
// 如果大于0,且小数点后位数大于0
|
||||
if _atom.GreaterThan(decimal.Zero) && _atom.Exponent() < 0 {
|
||||
|
||||
return _atom, cast.ToInt(math.Abs(float64(_atom.Exponent())))
|
||||
}
|
||||
}
|
||||
|
||||
return _defaultAtom, _defaultExp
|
||||
}
|
||||
|
||||
func GetPaymentMinAmount() decimal.Decimal {
|
||||
var _default = decimal.NewFromFloat(defaultPaymentMinAmount)
|
||||
var _min, _ = getPaymentRangeAmount()
|
||||
if _min == "" {
|
||||
|
||||
return _default
|
||||
}
|
||||
|
||||
_result, err := decimal.NewFromString(_min)
|
||||
if err == nil {
|
||||
|
||||
return _result
|
||||
}
|
||||
|
||||
return _default
|
||||
}
|
||||
|
||||
func GetPaymentMaxAmount() decimal.Decimal {
|
||||
var _default = decimal.NewFromFloat(defaultPaymentMaxAmount)
|
||||
var _, _max = getPaymentRangeAmount()
|
||||
if _max == "" {
|
||||
|
||||
return _default
|
||||
}
|
||||
|
||||
_result, err := decimal.NewFromString(_max)
|
||||
if err == nil {
|
||||
|
||||
return _result
|
||||
}
|
||||
|
||||
return _default
|
||||
}
|
||||
|
||||
func getPaymentRangeAmount() (string, string) {
|
||||
var _rangeVar string
|
||||
if _rangeVar = strings.TrimSpace(help.GetEnv("PAYMENT_AMOUNT_RANGE")); _rangeVar == "" {
|
||||
|
||||
return "", ""
|
||||
}
|
||||
|
||||
var _payRange = strings.Split(_rangeVar, ",")
|
||||
if len(_payRange) < 2 {
|
||||
|
||||
return "", ""
|
||||
}
|
||||
|
||||
return _payRange[0], _payRange[1]
|
||||
}
|
||||
|
||||
func GetExpireTime() time.Duration {
|
||||
if ret := help.GetEnv("EXPIRE_TIME"); ret != "" {
|
||||
sec, err := strconv.Atoi(ret)
|
||||
@@ -51,42 +134,6 @@ func GetUsdtRateRaw() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func GetTronServerApi() string {
|
||||
if data := help.GetEnv("TRON_SERVER_API"); data != "" {
|
||||
|
||||
return strings.TrimSpace(data)
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func GetTronScanApiKey() string {
|
||||
if data := help.GetEnv("TRON_SCAN_API_KEY"); data != "" {
|
||||
|
||||
return strings.TrimSpace(data)
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func GetTronGridApiKey() string {
|
||||
if data := help.GetEnv("TRON_GRID_API_KEY"); data != "" {
|
||||
|
||||
return strings.TrimSpace(data)
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func IsTronScanApi() bool {
|
||||
if GetTronServerApi() == TronServerApiScan {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
return GetTronServerApi() != TronServerApiGrid
|
||||
}
|
||||
|
||||
func GetUsdtRate() (string, decimal.Decimal, float64) {
|
||||
if data := help.GetEnv("USDT_RATE"); data != "" {
|
||||
data = strings.TrimSpace(data)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetAtomicity(t *testing.T) {
|
||||
|
||||
fmt.Println(GetAtomicity())
|
||||
}
|
||||
@@ -15,12 +15,12 @@ const OtherNotifyEnable = 1
|
||||
const OtherNotifyDisable = 0
|
||||
|
||||
type WalletAddress struct {
|
||||
Id int64 `gorm:"primary_key;AUTO_INCREMENT"`
|
||||
Address string `gorm:"type:varchar(255);not null;unique"`
|
||||
Status int `gorm:"type:tinyint(1);not null;default:1"`
|
||||
OtherNotify int `gorm:"type:tinyint(1);not null;default:1"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime;type:timestamp;not null"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime;type:timestamp;not null"`
|
||||
Id int64 `gorm:"integer;primaryKey;not null;comment:id"`
|
||||
Address string `gorm:"type:varchar(255);not null;unique;comment:钱包地址"`
|
||||
Status int `gorm:"type:tinyint(1);not null;default:1;comment:地址状态 1启动 0禁止"`
|
||||
OtherNotify int `gorm:"type:tinyint(1);not null;default:1;comment:其它转账通知 1启动 0禁止"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime;type:timestamp;not null;comment:创建时间"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime;type:timestamp;not null;comment:更新时间"`
|
||||
}
|
||||
|
||||
// 启动时添加初始钱包地址
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package model
|
||||
|
||||
type Config struct {
|
||||
K string `gorm:"column:k;type:varchar(32);primaryKey"`
|
||||
V string `gorm:"column:v;type:varchar(255)"`
|
||||
}
|
||||
|
||||
func (c Config) TableName() string {
|
||||
|
||||
return "config"
|
||||
}
|
||||
|
||||
func SetK(k, v string) {
|
||||
DB.Exec("REPLACE INTO config (k, v) VALUES (?, ?)", k, v)
|
||||
}
|
||||
|
||||
func GetK(k string) string {
|
||||
var row Config
|
||||
|
||||
var tx = DB.Where("k = ?", k).First(&row)
|
||||
if tx.Error == nil {
|
||||
|
||||
return row.V
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package model
|
||||
|
||||
const installSql = `
|
||||
-- trade_orders definition
|
||||
|
||||
CREATE TABLE trade_orders (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
order_id TEXT NOT NULL, -- 客户订单ID
|
||||
trade_id TEXT UNIQUE NOT NULL, -- 本地订单ID
|
||||
trade_hash TEXT NULL, -- 交易哈希
|
||||
usdt_rate TEXT NOT NULL, -- USDT汇率
|
||||
amount TEXT NOT NULL, -- USDT交易数额
|
||||
money TEXT NOT NULL, -- 订单交易金额
|
||||
address TEXT NOT NULL, -- 收款地址
|
||||
from_address TEXT NOT NULL, -- 支付地址
|
||||
status INTEGER DEFAULT 1 NOT NULL, -- 交易状态 1:等待支付 2:支付成功 3:订单过期
|
||||
return_url TEXT NULL, -- 同步地址
|
||||
notify_url TEXT NOT NULL, -- 异步地址
|
||||
notify_num INTEGER DEFAULT 0, -- 回调次数
|
||||
notify_state INTEGER DEFAULT 0, -- 回调状态 1:成功 0:失败
|
||||
expired_at TIMESTAMP NOT NULL, -- 订单失效时间
|
||||
created_at TIMESTAMP NOT NULL, -- 订单创建时间
|
||||
confirmed_at TIMESTAMP NULL, -- 交易确认时间
|
||||
updated_at TIMESTAMP NULL -- 最后更新时间
|
||||
);
|
||||
|
||||
-- wallet_address definition
|
||||
|
||||
CREATE TABLE wallet_address (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
address TEXT UNIQUE NOT NULL, -- 钱包地址
|
||||
status INTEGER DEFAULT 1 NOT NULL, -- 地址状态 1启动 0禁止
|
||||
other_notify INTEGER DEFAULT 1 NOT NULL, -- 其它转账通知 1启动 0禁止
|
||||
created_at TIMESTAMP NULL,
|
||||
updated_at TIMESTAMP NULL
|
||||
);
|
||||
|
||||
-- notify_record definition
|
||||
|
||||
CREATE TABLE notify_record (
|
||||
txid TEXT PRIMARY KEY NOT NULL, -- 交易哈希
|
||||
created_at TIMESTAMP NOT NULL, -- 创建时间
|
||||
updated_at TIMESTAMP NULL -- 更新时间
|
||||
);
|
||||
`
|
||||
+14
-16
@@ -1,9 +1,8 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/glebarez/sqlite"
|
||||
"github.com/v03413/bepusdt/app/config"
|
||||
"github.com/v03413/bepusdt/app/help"
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -11,25 +10,24 @@ var DB *gorm.DB
|
||||
var _err error
|
||||
|
||||
func Init() error {
|
||||
var dbPath = config.GetDbPath()
|
||||
if !help.IsExist(dbPath) {
|
||||
DB, _err = gorm.Open(sqlite.Open(dbPath), &gorm.Config{})
|
||||
if _err != nil {
|
||||
DB, _err = gorm.Open(sqlite.Open(config.GetDbPath()), &gorm.Config{})
|
||||
if _err != nil {
|
||||
|
||||
return _err
|
||||
}
|
||||
return _err
|
||||
|
||||
DB.Exec(installSql)
|
||||
addStartWalletAddress()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
DB, _err = gorm.Open(sqlite.Open(dbPath), &gorm.Config{})
|
||||
if _err == nil {
|
||||
if _err = AutoMigrate(); _err != nil {
|
||||
|
||||
addStartWalletAddress()
|
||||
return _err
|
||||
}
|
||||
|
||||
return _err
|
||||
addStartWalletAddress()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func AutoMigrate() error {
|
||||
|
||||
return DB.AutoMigrate(&WalletAddress{}, &TradeOrders{}, &NotifyRecord{}, &Config{})
|
||||
}
|
||||
|
||||
+32
-24
@@ -2,6 +2,7 @@ package model
|
||||
|
||||
import (
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/v03413/bepusdt/app/config"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -13,29 +14,29 @@ const OrderStatusWaiting = 1
|
||||
|
||||
const OrderNotifyStateSucc = 1
|
||||
const OrderNotifyStateFail = 0
|
||||
const Atomicity = 0.01 // 原子精度
|
||||
|
||||
var _calcMutex sync.Mutex
|
||||
|
||||
type TradeOrders struct {
|
||||
Id int64 `gorm:"primary_key;AUTO_INCREMENT"`
|
||||
OrderId string `gorm:"type:varchar(255);not null;unique"`
|
||||
TradeId string `gorm:"type:varchar(255);not null;unique"`
|
||||
TradeHash string `gorm:"type:varchar(64);default:'';unique"`
|
||||
UsdtRate string `gorm:"type:varchar(10);not null"`
|
||||
Amount string `gorm:"type:decimal(10,2);not null;default:0"`
|
||||
Money float64 `gorm:"type:decimal(10,2);not null;default:0"`
|
||||
Address string `gorm:"type:varchar(34);not null"`
|
||||
FromAddress string `gorm:"type:varchar(34);not null;default:''"`
|
||||
Status int `gorm:"type:tinyint(1);not null;default:0"`
|
||||
ReturnUrl string `gorm:"type:varchar(255);not null;default:''"`
|
||||
NotifyUrl string `gorm:"type:varchar(255);not null;default:''"`
|
||||
NotifyNum int `gorm:"type:int(11);not null;default:0"`
|
||||
NotifyState int `gorm:"type:tinyint(1);not null;default:0"`
|
||||
ExpiredAt time.Time `gorm:"type:timestamp;not null"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime;type:timestamp;not null"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime;type:timestamp;not null"`
|
||||
ConfirmedAt time.Time `gorm:"type:timestamp;null"`
|
||||
Id int64 `gorm:"primary_key;AUTO_INCREMENT;comment:id"`
|
||||
OrderId string `gorm:"type:varchar(255);not null;unique;color:blue;comment:客户订单ID"`
|
||||
TradeId string `gorm:"type:varchar(255);not null;unique;color:blue;comment:本地订单ID"`
|
||||
TradeHash string `gorm:"type:varchar(64);default:'';unique;comment:交易哈希"`
|
||||
UsdtRate string `gorm:"type:varchar(10);not null;comment:USDT汇率"`
|
||||
Amount string `gorm:"type:decimal(10,2);not null;default:0;comment:USDT交易数额"`
|
||||
Money float64 `gorm:"type:decimal(10,2);not null;default:0;comment:订单交易金额"`
|
||||
Address string `gorm:"type:varchar(34);not null;comment:收款地址"`
|
||||
FromAddress string `gorm:"type:varchar(34);not null;default:'';comment:支付地址"`
|
||||
Status int `gorm:"type:tinyint(1);not null;default:0;comment:交易状态 1:等待支付 2:支付成功 3:订单过期"`
|
||||
ReturnUrl string `gorm:"type:varchar(255);not null;default:'';comment:同步地址"`
|
||||
NotifyUrl string `gorm:"type:varchar(255);not null;default:'';comment:异步地址"`
|
||||
NotifyNum int `gorm:"type:int(11);not null;default:0;comment:回调次数"`
|
||||
NotifyState int `gorm:"type:tinyint(1);not null;default:0;comment:回调状态 1:成功 0:失败"`
|
||||
RefBlockNum int64 `gorm:"type:bigint(20);not null;default:0;comment:交易所在区块"`
|
||||
ExpiredAt time.Time `gorm:"type:timestamp;not null;comment:订单失效时间"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime;type:timestamp;not null;comment:创建时间"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime;type:timestamp;not null;comment:更新时间"`
|
||||
ConfirmedAt time.Time `gorm:"type:timestamp;null;comment:交易确认时间"`
|
||||
}
|
||||
|
||||
func (o *TradeOrders) OrderSetExpired() error {
|
||||
@@ -44,12 +45,19 @@ func (o *TradeOrders) OrderSetExpired() error {
|
||||
return DB.Save(o).Error
|
||||
}
|
||||
|
||||
func (o *TradeOrders) OrderSetSucc(fromAddress, tradeHash string, confirmedAt time.Time) error {
|
||||
// 订单标记交易成功
|
||||
o.Status = OrderStatusSuccess
|
||||
func (o *TradeOrders) OrderUpdateTxInfo(refBlockNum int64, fromAddress, tradeHash string, confirmedAt time.Time) error {
|
||||
o.FromAddress = fromAddress
|
||||
o.ConfirmedAt = confirmedAt
|
||||
o.TradeHash = tradeHash
|
||||
o.RefBlockNum = refBlockNum
|
||||
r := DB.Save(o)
|
||||
|
||||
return r.Error
|
||||
}
|
||||
|
||||
func (o *TradeOrders) OrderSetSucc() error {
|
||||
o.Status = OrderStatusSuccess // 标记成功
|
||||
|
||||
r := DB.Save(o)
|
||||
|
||||
return r.Error
|
||||
@@ -111,8 +119,8 @@ func CalcTradeAmount(wa []WalletAddress, rate, money float64) (WalletAddress, st
|
||||
_lock[_order.Address+_order.Amount] = true
|
||||
}
|
||||
|
||||
var _atom = decimal.NewFromFloat(Atomicity)
|
||||
var payAmount = strconv.FormatFloat(money/rate, 'f', 2, 64)
|
||||
var _atom, _prec = config.GetAtomicity()
|
||||
var payAmount = strconv.FormatFloat(money/rate, 'f', _prec, 64)
|
||||
var _payAmount, _ = decimal.NewFromString(payAmount)
|
||||
for {
|
||||
for _, address := range wa {
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@ import (
|
||||
)
|
||||
|
||||
type NotifyRecord struct {
|
||||
Txid string `gorm:"primary_key;type:varchar(64);not null"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime;type:timestamp;not null"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime;type:timestamp;not null"`
|
||||
Txid string `gorm:"primary_key;type:varchar(64);not null;comment:交易哈希"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime;type:timestamp;not null;comment:创建时间"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime;type:timestamp;not null;comment:更新时间"`
|
||||
}
|
||||
|
||||
func (nr *NotifyRecord) TableName() string {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/v03413/bepusdt/app/config"
|
||||
)
|
||||
|
||||
var _paymentMinAmount, _paymentMaxAmount decimal.Decimal
|
||||
|
||||
func init() {
|
||||
_paymentMinAmount = config.GetPaymentMinAmount()
|
||||
_paymentMaxAmount = config.GetPaymentMaxAmount()
|
||||
}
|
||||
|
||||
func inPaymentAmountRange(payAmount decimal.Decimal) bool {
|
||||
if payAmount.GreaterThan(_paymentMaxAmount) {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
if payAmount.LessThan(_paymentMinAmount) {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -9,15 +9,21 @@ import (
|
||||
var err error
|
||||
|
||||
func BotStart(version string) {
|
||||
var BotApi = telegram.GetBotApi()
|
||||
if BotApi == nil {
|
||||
var botApi = telegram.GetBotApi()
|
||||
if botApi == nil {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
_, err = botApi.MakeRequest("deleteWebhook", tgbotapi.Params{})
|
||||
if err != nil {
|
||||
|
||||
log.Error("TG Bot deleteWebhook Error:", err)
|
||||
}
|
||||
|
||||
u := tgbotapi.NewUpdate(0)
|
||||
u.Timeout = 60
|
||||
updates := BotApi.GetUpdatesChan(u)
|
||||
updates := botApi.GetUpdatesChan(u)
|
||||
if err != nil {
|
||||
log.Error("TG Bot GetUpdatesChan Error:", err)
|
||||
|
||||
|
||||
+4
-357
@@ -2,75 +2,12 @@ package monitor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/v03413/bepusdt/app/config"
|
||||
"github.com/v03413/bepusdt/app/help"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/notify"
|
||||
"github.com/v03413/bepusdt/app/telegram"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
const usdtToken = "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
|
||||
|
||||
func TradeStart() {
|
||||
log.Info("交易监控启动.")
|
||||
|
||||
for range time.Tick(time.Second * 5) {
|
||||
var recentTransferTotal float64
|
||||
var _lock, err = getAllPendingOrders()
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
for _, _row := range model.GetAvailableAddress() {
|
||||
var result gjson.Result
|
||||
var err error
|
||||
|
||||
if config.IsTronScanApi() {
|
||||
result, err = getUsdtTrc20TransByTronScan(_row.Address)
|
||||
} else {
|
||||
result, err = getUsdtTrc20TransByTronGrid(_row.Address)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if config.IsTronScanApi() {
|
||||
recentTransferTotal = result.Get("total").Num
|
||||
} else {
|
||||
recentTransferTotal = result.Get("meta.page_size").Num
|
||||
}
|
||||
|
||||
log.Info(fmt.Sprintf("[%s] recent transfer total: %s(%v)", config.GetTronServerApi(), _row.Address, recentTransferTotal))
|
||||
if recentTransferTotal <= 0 { // 没有交易记录
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if config.IsTronScanApi() {
|
||||
handlePaymentTransactionForTronScan(_lock, _row.Address, result)
|
||||
handleOtherNotifyForTronScan(_row.Address, result)
|
||||
} else {
|
||||
handlePaymentTransactionForTronGrid(_lock, _row.Address, result)
|
||||
handleOtherNotifyForTronGrid(_row.Address, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 列出所有等待支付的交易订单
|
||||
func getAllPendingOrders() (map[string]model.TradeOrders, error) {
|
||||
tradeOrders, err := model.GetTradeOrderByStatus(model.OrderStatusWaiting)
|
||||
@@ -98,301 +35,11 @@ func getAllPendingOrders() (map[string]model.TradeOrders, error) {
|
||||
return _lock, nil
|
||||
}
|
||||
|
||||
// 处理支付交易 TronScan
|
||||
func handlePaymentTransactionForTronScan(_lock map[string]model.TradeOrders, _toAddress string, _data gjson.Result) {
|
||||
for _, transfer := range _data.Get("token_transfers").Array() {
|
||||
if transfer.Get("to_address").String() != _toAddress {
|
||||
// 不是接收地址
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// 计算交易金额
|
||||
var _quant = parseTransAmount(transfer.Get("quant").Float())
|
||||
|
||||
_order, ok := _lock[_toAddress+_quant]
|
||||
if !ok || transfer.Get("contractRet").String() != "SUCCESS" {
|
||||
// 订单不存在或交易失败
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// 判断时间是否有效
|
||||
var _createdAt = time.UnixMilli(transfer.Get("block_ts").Int())
|
||||
if _createdAt.Unix() < _order.CreatedAt.Unix() || _createdAt.Unix() > _order.ExpiredAt.Unix() {
|
||||
// 失效交易
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
var _transId = transfer.Get("transaction_id").String()
|
||||
var _fromAddress = transfer.Get("from_address").String()
|
||||
if _order.OrderSetSucc(_fromAddress, _transId, _createdAt) == nil {
|
||||
// 通知订单支付成功
|
||||
go notify.OrderNotify(_order)
|
||||
|
||||
// TG发送订单信息
|
||||
go telegram.SendTradeSuccMsg(_order)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理支付交易 TronGrid
|
||||
func handlePaymentTransactionForTronGrid(_lock map[string]model.TradeOrders, _toAddress string, result gjson.Result) {
|
||||
for _, transfer := range result.Get("data").Array() {
|
||||
if transfer.Get("to").String() != _toAddress {
|
||||
// 不是接收地址
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// 计算交易金额
|
||||
var _quant = parseTransAmount(transfer.Get("value").Float())
|
||||
_order, ok := _lock[_toAddress+_quant]
|
||||
if !ok || transfer.Get("type").String() != "Transfer" {
|
||||
// 订单不存在或交易失败
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// 判断时间是否有效
|
||||
var _createdAt = time.UnixMilli(transfer.Get("block_timestamp").Int())
|
||||
if _createdAt.Unix() < _order.CreatedAt.Unix() || _createdAt.Unix() > _order.ExpiredAt.Unix() {
|
||||
// 失效交易
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
var _transId = transfer.Get("transaction_id").String()
|
||||
var _fromAddress = transfer.Get("from").String()
|
||||
if _order.OrderSetSucc(_fromAddress, _transId, _createdAt) == nil {
|
||||
// 通知订单支付成功
|
||||
go notify.OrderNotify(_order)
|
||||
|
||||
// TG发送订单信息
|
||||
go telegram.SendTradeSuccMsg(_order)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 非订单交易通知
|
||||
func handleOtherNotifyForTronScan(_toAddress string, result gjson.Result) {
|
||||
for _, transfer := range result.Get("token_transfers").Array() {
|
||||
if !model.GetOtherNotify(_toAddress) {
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
var _amount = parseTransAmount(transfer.Get("quant").Float())
|
||||
var _created = time.UnixMilli(transfer.Get("block_ts").Int())
|
||||
var _txid = transfer.Get("transaction_id").String()
|
||||
var _detailUrl = "https://tronscan.org/#/transaction/" + _txid
|
||||
if !model.IsNeedNotifyByTxid(_txid) {
|
||||
// 不需要额外通知
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
var title = "收入"
|
||||
if transfer.Get("to_address").String() != _toAddress {
|
||||
title = "支出"
|
||||
}
|
||||
|
||||
var text = fmt.Sprintf(
|
||||
"#账户%s #非订单交易\n---\n```\n💲交易数额:%v USDT.TRC20\n⏱️交易时间:%v\n✅接收地址:%v\n🅾️发送地址:%v```\n",
|
||||
title,
|
||||
_amount,
|
||||
_created.Format(time.DateTime),
|
||||
help.MaskAddress(transfer.Get("to_address").String()),
|
||||
help.MaskAddress(transfer.Get("from_address").String()),
|
||||
)
|
||||
|
||||
var chatId, err = strconv.ParseInt(config.GetTgBotNotifyTarget(), 10, 64)
|
||||
if err != nil {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
var msg = tgbotapi.NewMessage(chatId, text)
|
||||
msg.ParseMode = tgbotapi.ModeMarkdown
|
||||
msg.ReplyMarkup = tgbotapi.InlineKeyboardMarkup{
|
||||
InlineKeyboard: [][]tgbotapi.InlineKeyboardButton{
|
||||
{
|
||||
tgbotapi.NewInlineKeyboardButtonURL("📝查看交易明细", _detailUrl),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var _record = model.NotifyRecord{Txid: _txid}
|
||||
model.DB.Create(&_record)
|
||||
|
||||
go telegram.SendMsg(msg)
|
||||
}
|
||||
}
|
||||
|
||||
func handleOtherNotifyForTronGrid(_toAddress string, result gjson.Result) {
|
||||
for _, transfer := range result.Get("data").Array() {
|
||||
if !model.GetOtherNotify(_toAddress) {
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
var _amount = parseTransAmount(transfer.Get("value").Float())
|
||||
var _created = time.UnixMilli(transfer.Get("block_timestamp").Int())
|
||||
var _txid = transfer.Get("transaction_id").String()
|
||||
var _detailUrl = "https://tronscan.org/#/transaction/" + _txid
|
||||
if !model.IsNeedNotifyByTxid(_txid) {
|
||||
// 不需要额外通知
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
var title = "收入"
|
||||
if transfer.Get("to").String() != _toAddress {
|
||||
title = "支出"
|
||||
}
|
||||
|
||||
var text = fmt.Sprintf(
|
||||
"#账户%s #非订单交易\n---\n```\n💲交易数额:%v USDT.TRC20\n⏱️交易时间:%v\n✅接收地址:%v\n🅾️发送地址:%v```\n",
|
||||
title,
|
||||
_amount,
|
||||
_created.Format(time.DateTime),
|
||||
help.MaskAddress(transfer.Get("to").String()),
|
||||
help.MaskAddress(transfer.Get("from").String()),
|
||||
)
|
||||
|
||||
var chatId, err = strconv.ParseInt(config.GetTgBotNotifyTarget(), 10, 64)
|
||||
if err != nil {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
var msg = tgbotapi.NewMessage(chatId, text)
|
||||
msg.ParseMode = tgbotapi.ModeMarkdown
|
||||
msg.ReplyMarkup = tgbotapi.InlineKeyboardMarkup{
|
||||
InlineKeyboard: [][]tgbotapi.InlineKeyboardButton{
|
||||
{
|
||||
tgbotapi.NewInlineKeyboardButtonURL("📝查看交易明细", _detailUrl),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var _record = model.NotifyRecord{Txid: _txid}
|
||||
model.DB.Create(&_record)
|
||||
|
||||
go telegram.SendMsg(msg)
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索交易记录 TronScan
|
||||
func getUsdtTrc20TransByTronScan(_toAddress string) (gjson.Result, error) {
|
||||
var now = time.Now()
|
||||
var client = &http.Client{Timeout: time.Second * 15}
|
||||
req, err := http.NewRequest("GET", "https://apilist.tronscanapi.com/api/new/token_trc20/transfers", nil)
|
||||
if err != nil {
|
||||
|
||||
return gjson.Result{}, fmt.Errorf("处理请求创建错误: %w", err)
|
||||
}
|
||||
|
||||
// 构建请求参数
|
||||
var params = url.Values{}
|
||||
params.Add("start", "0")
|
||||
params.Add("limit", "30")
|
||||
params.Add("contract_address", usdtToken)
|
||||
params.Add("start_timestamp", strconv.FormatInt(now.Add(-time.Hour).UnixMilli(), 10)) // 当前时间向前推 1 小时
|
||||
params.Add("end_timestamp", strconv.FormatInt(now.Add(time.Hour).UnixMilli(), 10)) // 当前时间向后推 1 小时
|
||||
params.Add("relatedAddress", _toAddress)
|
||||
if config.GetTradeConfirmed() {
|
||||
params.Add("confirm", "true")
|
||||
} else {
|
||||
params.Add("confirm", "false")
|
||||
}
|
||||
req.URL.RawQuery = params.Encode()
|
||||
|
||||
if config.GetTronScanApiKey() != "" {
|
||||
|
||||
req.Header.Add("TRON-PRO-API-KEY", config.GetTronScanApiKey())
|
||||
}
|
||||
|
||||
// 请求交易记录
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
|
||||
return gjson.Result{}, fmt.Errorf("请求交易记录错误: %w", err)
|
||||
}
|
||||
|
||||
// 获取响应记录
|
||||
all, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
|
||||
return gjson.Result{}, fmt.Errorf("读取交易记录错误: %w", err)
|
||||
}
|
||||
|
||||
// 释放响应请求
|
||||
_ = resp.Body.Close()
|
||||
|
||||
// 解析响应记录
|
||||
return gjson.ParseBytes(all), nil
|
||||
}
|
||||
|
||||
// 搜索交易记录 TronGrid
|
||||
func getUsdtTrc20TransByTronGrid(_toAddress string) (gjson.Result, error) {
|
||||
var now = time.Now()
|
||||
var client = &http.Client{Timeout: time.Second * 15}
|
||||
req, err := http.NewRequest("GET", fmt.Sprintf("https://api.trongrid.io/v1/accounts/%s/transactions/trc20", _toAddress), nil)
|
||||
if err != nil {
|
||||
|
||||
return gjson.Result{}, fmt.Errorf("处理请求创建错误: %w", err)
|
||||
}
|
||||
|
||||
// 构建请求参数
|
||||
var params = url.Values{}
|
||||
params.Add("limit", "30")
|
||||
params.Add("contract_address", usdtToken)
|
||||
params.Add("min_timestamp", strconv.FormatInt(now.Add(-time.Hour).UnixMilli(), 10)) // 当前时间向前推 3 小时
|
||||
params.Add("max_timestamp", strconv.FormatInt(now.Add(time.Hour).UnixMilli(), 10)) // 当前时间向后推 1 小时
|
||||
params.Add("order_by", "block_timestamp,desc")
|
||||
if config.GetTradeConfirmed() {
|
||||
params.Add("only_confirmed", "true")
|
||||
} else {
|
||||
params.Add("only_confirmed", "false")
|
||||
}
|
||||
if config.GetTronGridApiKey() != "" {
|
||||
|
||||
req.Header.Add("TRON-PRO-API-KEY", config.GetTronGridApiKey())
|
||||
}
|
||||
|
||||
req.URL.RawQuery = params.Encode()
|
||||
|
||||
// 请求交易记录
|
||||
resp, err := client.Do(req)
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
|
||||
return gjson.Result{}, fmt.Errorf("请求交易记录错误: StatusCode != 200")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
return gjson.Result{}, fmt.Errorf("请求交易记录错误: %w", err)
|
||||
}
|
||||
|
||||
// 获取响应记录
|
||||
all, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
|
||||
return gjson.Result{}, fmt.Errorf("读取交易记录错误: %w", err)
|
||||
}
|
||||
|
||||
// 释放响应请求
|
||||
_ = resp.Body.Close()
|
||||
|
||||
// 解析响应记录
|
||||
return gjson.ParseBytes(all), nil
|
||||
}
|
||||
|
||||
// 解析交易金额
|
||||
func parseTransAmount(amount float64) string {
|
||||
func parseTransAmount(amount float64) (decimal.Decimal, string) {
|
||||
var _decimalAmount = decimal.NewFromFloat(amount)
|
||||
var _decimalDivisor = decimal.NewFromFloat(1000000)
|
||||
return _decimalAmount.Div(_decimalDivisor).String()
|
||||
var result = _decimalAmount.Div(_decimalDivisor)
|
||||
|
||||
return result, result.String()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,412 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/btcsuite/btcd/btcutil/base58"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
"github.com/v03413/bepusdt/app/config"
|
||||
"github.com/v03413/bepusdt/app/help"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/notify"
|
||||
"github.com/v03413/bepusdt/app/telegram"
|
||||
"github.com/v03413/tronprotocol/api"
|
||||
"github.com/v03413/tronprotocol/core"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 交易所在区块高度和当前区块高度差值超过20,说明此交易已经被网络确认
|
||||
const blockHeightNumConfirmedSub = 20
|
||||
|
||||
// usdt trc20 contract address 41a614f803b6fd780986a42c78ec9c7f77e6ded13c TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
|
||||
var usdtTrc20ContractAddress = []byte{0x41, 0xa6, 0x14, 0xf8, 0x03, 0xb6, 0xfd, 0x78, 0x09, 0x86, 0xa4, 0x2c, 0x78, 0xec, 0x9c, 0x7f, 0x77, 0xe6, 0xde, 0xd1, 0x3c}
|
||||
|
||||
var currentBlockHeight int64
|
||||
|
||||
type resource struct {
|
||||
ID string
|
||||
Type core.ResourceCode
|
||||
Balance int64
|
||||
FromAddress string
|
||||
RecvAddress string
|
||||
Timestamp time.Time
|
||||
}
|
||||
|
||||
type transfer struct {
|
||||
ID string
|
||||
Amount float64
|
||||
FromAddress string
|
||||
RecvAddress string
|
||||
Timestamp time.Time
|
||||
}
|
||||
|
||||
type usdtTrc20TransferRaw struct {
|
||||
RecvAddress string
|
||||
Amount float64
|
||||
}
|
||||
|
||||
// BlockScanStart 区块扫描
|
||||
func BlockScanStart() {
|
||||
var node = config.GetTronGrpcNode()
|
||||
log.Info("区块扫描启动:", node)
|
||||
|
||||
conn, err := grpc.NewClient(node, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
if err != nil {
|
||||
|
||||
log.Error("grpc.NewClient", err)
|
||||
}
|
||||
|
||||
var ctx = context.Background()
|
||||
var client = api.NewWalletClient(conn)
|
||||
|
||||
for range time.Tick(time.Second * 3) { // 3秒产生一个区块
|
||||
nowBlock, err := client.GetNowBlock2(ctx, nil) // 获取当前区块高度
|
||||
if err != nil {
|
||||
log.Warn("GetNowBlock", err)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if currentBlockHeight == 0 { // 初始化当前区块高度
|
||||
|
||||
currentBlockHeight = nowBlock.BlockHeader.RawData.Number - 1
|
||||
}
|
||||
|
||||
// 连续区块
|
||||
var sub = nowBlock.BlockHeader.RawData.Number - currentBlockHeight
|
||||
if sub == 1 {
|
||||
parseBlockTrans(nowBlock, nowBlock.BlockHeader.RawData.Number)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// 如果当前区块高度和上次扫描的区块高度差值超过1,说明存在区块丢失
|
||||
var startBlockHeight = currentBlockHeight + 1
|
||||
var endBlockHeight = nowBlock.BlockHeader.RawData.Number
|
||||
|
||||
// 扫描丢失的区块
|
||||
blocks, err := client.GetBlockByLimitNext2(ctx, &api.BlockLimit{StartNum: startBlockHeight, EndNum: endBlockHeight})
|
||||
if err != nil {
|
||||
log.Warn("GetBlockByLimitNext2", err)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// 扫描丢失区块
|
||||
for _, block := range blocks.GetBlock() {
|
||||
|
||||
parseBlockTrans(block, block.BlockHeader.RawData.Number)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// parseBlockTrans 解析区块交易
|
||||
func parseBlockTrans(block *api.BlockExtention, nowHeight int64) {
|
||||
currentBlockHeight = nowHeight
|
||||
|
||||
var unDelegateResources = make([]resource, 0)
|
||||
var delegateResources = make([]resource, 0)
|
||||
var trxTransfer = make([]transfer, 0)
|
||||
var usdtTrc20Transfer = make([]transfer, 0)
|
||||
var timestamp = time.UnixMilli(block.GetBlockHeader().GetRawData().GetTimestamp())
|
||||
for _, v := range block.GetTransactions() {
|
||||
if !v.Result.Result {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
var itm = v.GetTransaction()
|
||||
var id = hex.EncodeToString(v.Txid)
|
||||
for _, contract := range itm.GetRawData().GetContract() {
|
||||
// 资源代理 DelegateResourceContract
|
||||
if contract.GetType() == core.Transaction_Contract_DelegateResourceContract {
|
||||
var foo = &core.DelegateResourceContract{}
|
||||
err := contract.GetParameter().UnmarshalTo(foo)
|
||||
if err != nil {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
delegateResources = append(delegateResources, resource{
|
||||
ID: id,
|
||||
Type: foo.Resource,
|
||||
Balance: foo.Balance,
|
||||
FromAddress: base58CheckEncode(foo.OwnerAddress),
|
||||
RecvAddress: base58CheckEncode(foo.ReceiverAddress),
|
||||
Timestamp: timestamp,
|
||||
})
|
||||
}
|
||||
|
||||
// 资源回收 UnDelegateResourceContract
|
||||
if contract.GetType() == core.Transaction_Contract_UnDelegateResourceContract {
|
||||
var foo = &core.UnDelegateResourceContract{}
|
||||
err := contract.GetParameter().UnmarshalTo(foo)
|
||||
if err != nil {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
unDelegateResources = append(unDelegateResources, resource{
|
||||
ID: id,
|
||||
Type: foo.Resource,
|
||||
Balance: foo.Balance,
|
||||
FromAddress: base58CheckEncode(foo.OwnerAddress),
|
||||
RecvAddress: base58CheckEncode(foo.ReceiverAddress),
|
||||
Timestamp: timestamp,
|
||||
})
|
||||
}
|
||||
|
||||
// TRX转账交易
|
||||
if contract.GetType() == core.Transaction_Contract_TransferContract {
|
||||
var foo = &core.TransferContract{}
|
||||
err := contract.GetParameter().UnmarshalTo(foo)
|
||||
if err != nil {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
trxTransfer = append(trxTransfer, transfer{
|
||||
ID: id,
|
||||
Amount: float64(foo.Amount),
|
||||
FromAddress: base58CheckEncode(foo.OwnerAddress),
|
||||
RecvAddress: base58CheckEncode(foo.ToAddress),
|
||||
Timestamp: timestamp,
|
||||
})
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// 触发智能合约
|
||||
if contract.GetType() == core.Transaction_Contract_TriggerSmartContract {
|
||||
var foo = &core.TriggerSmartContract{}
|
||||
err := contract.GetParameter().UnmarshalTo(foo)
|
||||
if err != nil {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
var transItem = transfer{Timestamp: timestamp, ID: id, FromAddress: base58CheckEncode(foo.OwnerAddress)}
|
||||
var reader = bytes.NewReader(foo.GetData())
|
||||
if !bytes.Equal(foo.GetContractAddress(), usdtTrc20ContractAddress) { // usdt trc20 contract
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// 解析合约数据
|
||||
var trc20Contract = parseUsdtTrc20Contract(reader)
|
||||
if trc20Contract.Amount == 0 {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
transItem.Amount = trc20Contract.Amount
|
||||
transItem.RecvAddress = trc20Contract.RecvAddress
|
||||
|
||||
usdtTrc20Transfer = append(usdtTrc20Transfer, transItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(usdtTrc20Transfer) > 0 {
|
||||
handleOrderTransaction(block.GetBlockHeader().GetRawData().GetNumber(), nowHeight, usdtTrc20Transfer)
|
||||
handleOtherNotify(usdtTrc20Transfer)
|
||||
}
|
||||
|
||||
if len(trxTransfer) > 0 {
|
||||
|
||||
}
|
||||
if len(unDelegateResources) > 0 {
|
||||
|
||||
}
|
||||
if len(delegateResources) > 0 {
|
||||
|
||||
}
|
||||
|
||||
log.Info("区块扫描完成:", nowHeight)
|
||||
}
|
||||
|
||||
// parseUsdtTrc20Contract 解析usdt trc20合约
|
||||
func parseUsdtTrc20Contract(reader *bytes.Reader) usdtTrc20TransferRaw {
|
||||
var funcName = make([]byte, 4)
|
||||
_, err = reader.Read(funcName)
|
||||
if err != nil {
|
||||
// 读取funcName失败
|
||||
|
||||
return usdtTrc20TransferRaw{}
|
||||
}
|
||||
if !bytes.Equal(funcName, []byte{0xa9, 0x05, 0x9c, 0xbb}) { // a9059cbb transfer(address,uint256)
|
||||
// funcName不匹配transfer
|
||||
|
||||
return usdtTrc20TransferRaw{}
|
||||
}
|
||||
|
||||
var addressBytes = make([]byte, 20)
|
||||
_, err = reader.ReadAt(addressBytes, 4+12)
|
||||
if err != nil {
|
||||
// 读取toAddress失败
|
||||
|
||||
return usdtTrc20TransferRaw{}
|
||||
}
|
||||
|
||||
var toAddress = base58CheckEncode(append([]byte{0x41}, addressBytes...))
|
||||
var value = make([]byte, 32)
|
||||
_, err = reader.ReadAt(value, 36)
|
||||
if err != nil {
|
||||
// 读取value失败
|
||||
|
||||
return usdtTrc20TransferRaw{}
|
||||
}
|
||||
|
||||
var amount, _ = strconv.ParseInt(hex.EncodeToString(value), 16, 64)
|
||||
|
||||
return usdtTrc20TransferRaw{RecvAddress: toAddress, Amount: float64(amount)}
|
||||
}
|
||||
|
||||
// handleOrderTransaction 处理支付交易
|
||||
func handleOrderTransaction(refBlockNum, nowHeight int64, items []transfer) {
|
||||
var orders, err = getAllPendingOrders()
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
for _, tx := range items {
|
||||
// 计算交易金额
|
||||
var amount, quant = parseTransAmount(tx.Amount)
|
||||
|
||||
// 判断金额是否在允许范围内
|
||||
if !inPaymentAmountRange(amount) {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// 判断是否存在对应订单
|
||||
order, isOrder := orders[fmt.Sprintf("%s%v", tx.RecvAddress, quant)]
|
||||
if !isOrder {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// 判断时间是否在有效期内
|
||||
if tx.Timestamp.Unix() < order.CreatedAt.Unix() || tx.Timestamp.Unix() > order.ExpiredAt.Unix() {
|
||||
// 已失效
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// 更新订单交易信息
|
||||
var err = order.OrderUpdateTxInfo(refBlockNum, tx.FromAddress, tx.ID, tx.Timestamp)
|
||||
if err != nil {
|
||||
|
||||
log.Error("OrderUpdateTxInfo", err)
|
||||
}
|
||||
}
|
||||
|
||||
for _, order := range orders {
|
||||
if order.RefBlockNum == 0 || order.TradeHash == "" {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// 判断交易是否需要被确认
|
||||
var confirmedSub int64 = 0
|
||||
if config.GetTradeConfirmed() {
|
||||
|
||||
confirmedSub = blockHeightNumConfirmedSub
|
||||
}
|
||||
|
||||
if nowHeight-order.RefBlockNum <= confirmedSub {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
var err = order.OrderSetSucc()
|
||||
if err != nil {
|
||||
log.Error("OrderSetSucc", err)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
go notify.OrderNotify(order) // 通知订单支付成功
|
||||
go telegram.SendTradeSuccMsg(order) // TG发送订单信息
|
||||
}
|
||||
}
|
||||
|
||||
// handleOtherNotify 处理其他通知
|
||||
func handleOtherNotify(items []transfer) {
|
||||
var ads []model.WalletAddress
|
||||
var tx = model.DB.Where("status = ? and other_notify = ?", model.StatusEnable, model.OtherNotifyEnable).Find(&ads)
|
||||
if tx.RowsAffected <= 0 {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
for _, wa := range ads {
|
||||
for _, trans := range items {
|
||||
if trans.RecvAddress != wa.Address && trans.FromAddress != wa.Address {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
var _, amount = parseTransAmount(trans.Amount)
|
||||
var detailUrl = "https://tronscan.org/#/transaction/" + trans.ID
|
||||
if !model.IsNeedNotifyByTxid(trans.ID) {
|
||||
// 不需要额外通知
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
var title = "收入"
|
||||
if trans.RecvAddress != wa.Address {
|
||||
title = "支出"
|
||||
}
|
||||
|
||||
var text = fmt.Sprintf(
|
||||
"#账户%s #非订单交易\n---\n```\n💲交易数额:%v USDT.TRC20\n⏱️交易时间:%v\n✅接收地址:%v\n🅾️发送地址:%v```\n",
|
||||
title,
|
||||
amount,
|
||||
trans.Timestamp.Format(time.DateTime),
|
||||
help.MaskAddress(trans.RecvAddress),
|
||||
help.MaskAddress(trans.FromAddress),
|
||||
)
|
||||
|
||||
var chatId, err = strconv.ParseInt(config.GetTgBotNotifyTarget(), 10, 64)
|
||||
if err != nil {
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
var msg = tgbotapi.NewMessage(chatId, text)
|
||||
msg.ParseMode = tgbotapi.ModeMarkdown
|
||||
msg.ReplyMarkup = tgbotapi.InlineKeyboardMarkup{
|
||||
InlineKeyboard: [][]tgbotapi.InlineKeyboardButton{
|
||||
{
|
||||
tgbotapi.NewInlineKeyboardButtonURL("📝查看交易明细", detailUrl),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var _record = model.NotifyRecord{Txid: trans.ID}
|
||||
model.DB.Create(&_record)
|
||||
|
||||
go telegram.SendMsg(msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func base58CheckEncode(input []byte) string {
|
||||
checksum := chainhash.DoubleHashB(input)
|
||||
checksum = checksum[:4]
|
||||
|
||||
input = append(input, checksum...)
|
||||
|
||||
return base58.Encode(input)
|
||||
}
|
||||
@@ -129,7 +129,7 @@ func cbAddressOtherNotifyAction(query *tgbotapi.CallbackQuery, id string) {
|
||||
}
|
||||
}
|
||||
|
||||
func cbOrderDetailAction(query *tgbotapi.CallbackQuery, tradeId string) {
|
||||
func cbOrderDetailAction(tradeId string) {
|
||||
var o model.TradeOrders
|
||||
|
||||
if model.DB.Where("trade_id = ?", tradeId).First(&o).Error == nil {
|
||||
@@ -170,6 +170,7 @@ func cbOrderDetailAction(query *tgbotapi.CallbackQuery, tradeId string) {
|
||||
InlineKeyboard: [][]tgbotapi.InlineKeyboardButton{
|
||||
{
|
||||
tgbotapi.NewInlineKeyboardButtonURL("🌏商户网站", _site.String()),
|
||||
tgbotapi.NewInlineKeyboardButtonURL("📝交易明细", "https://tronscan.org/#/transaction/"+o.TradeHash),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ func HandleCallback(query *tgbotapi.CallbackQuery) {
|
||||
case cbAddressOtherNotify:
|
||||
go cbAddressOtherNotifyAction(query, args[1])
|
||||
case cbOrderDetail:
|
||||
go cbOrderDetailAction(query, args[1])
|
||||
go cbOrderDetailAction(args[1])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -53,6 +53,7 @@ func CreateTransaction(ctx *gin.Context) {
|
||||
var _orderData = model.TradeOrders{
|
||||
OrderId: _orderId,
|
||||
TradeId: _tradeId,
|
||||
TradeHash: _tradeId, // 这里默认填充一个本地交易ID,等支付成功后再更新为实际交易哈希
|
||||
UsdtRate: fmt.Sprintf("%v", rate),
|
||||
Amount: _amount,
|
||||
Money: _money,
|
||||
@@ -79,7 +80,7 @@ func CreateTransaction(ctx *gin.Context) {
|
||||
"amount": _money,
|
||||
"actual_amount": _amount,
|
||||
"token": address.Address,
|
||||
"expiration_time": _expiredAt.Second(),
|
||||
"expiration_time": int64(_expiredAt.Sub(time.Now()).Seconds()),
|
||||
"payment_url": fmt.Sprintf("%s/pay/checkout-counter/%s", config.GetAppUri(_host), _tradeId),
|
||||
}))
|
||||
log.Info(fmt.Sprintf("订单创建成功,商户订单号:%s", _orderId))
|
||||
|
||||
@@ -78,6 +78,7 @@ func Start() {
|
||||
|
||||
ctx.Set("data", m)
|
||||
})
|
||||
|
||||
orderRoute.POST("/create-transaction", CreateTransaction)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,30 @@
|
||||
module github.com/v03413/bepusdt
|
||||
|
||||
go 1.22
|
||||
go 1.23.0
|
||||
|
||||
require (
|
||||
github.com/btcsuite/btcd/btcutil v1.1.6
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
|
||||
github.com/gin-gonic/gin v1.9.1
|
||||
github.com/glebarez/sqlite v1.11.0
|
||||
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1
|
||||
github.com/goccy/go-json v0.10.2
|
||||
github.com/google/uuid v1.3.1
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/shopspring/decimal v1.3.1
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/tidwall/gjson v1.17.0
|
||||
gorm.io/driver/sqlite v1.5.4
|
||||
gorm.io/gorm v1.25.4
|
||||
github.com/v03413/tronprotocol v0.0.0-20240824084238-bbd62f5e0158
|
||||
google.golang.org/grpc v1.65.0
|
||||
gorm.io/gorm v1.25.10
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/bytedance/sonic v1.9.1 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/glebarez/go-sqlite v1.21.2 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.14.0 // indirect
|
||||
@@ -28,19 +34,27 @@ require (
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
||||
github.com/leodido/go-urn v1.2.4 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.17 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/ncruces/go-strftime v0.1.9 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/spf13/cast v1.7.0 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||
golang.org/x/arch v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.9.0 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
golang.org/x/crypto v0.24.0 // indirect
|
||||
golang.org/x/net v0.26.0 // indirect
|
||||
golang.org/x/sys v0.21.0 // indirect
|
||||
golang.org/x/text v0.16.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240823204242-4ba0660f739c // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
modernc.org/libc v1.41.0 // indirect
|
||||
modernc.org/mathutil v1.6.0 // indirect
|
||||
modernc.org/memory v1.7.2 // indirect
|
||||
modernc.org/sqlite v1.29.1 // indirect
|
||||
)
|
||||
|
||||
@@ -1,18 +1,56 @@
|
||||
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
||||
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
||||
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
|
||||
github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A=
|
||||
github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY=
|
||||
github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
|
||||
github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A=
|
||||
github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE=
|
||||
github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00=
|
||||
github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c=
|
||||
github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
|
||||
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
|
||||
github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I=
|
||||
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
||||
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
||||
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
|
||||
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
|
||||
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
|
||||
github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s=
|
||||
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
|
||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
|
||||
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
|
||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
|
||||
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
|
||||
github.com/glebarez/go-sqlite v1.21.2 h1:3a6LFC4sKahUunAmynQKLZceZCOzUthkRkEAl9gAXWo=
|
||||
github.com/glebarez/go-sqlite v1.21.2/go.mod h1:sfxdZyhQjTM2Wry3gVYWaW072Ri1WMdWJi0k6+3382k=
|
||||
github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw=
|
||||
github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
@@ -25,18 +63,36 @@ github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 h1:wG8n/XJQ07TmjbITcGi
|
||||
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1/go.mod h1:A2S0CWkNylc2phvKXWBBdD3K0iGnDBGbzRpISP2zBl8=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=
|
||||
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
|
||||
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
||||
@@ -44,21 +100,34 @@ github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
|
||||
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
|
||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
|
||||
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
||||
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
|
||||
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=
|
||||
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
|
||||
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w=
|
||||
github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
@@ -68,8 +137,10 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
|
||||
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
|
||||
github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM=
|
||||
github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
@@ -81,32 +152,78 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
|
||||
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/v03413/tronprotocol v0.0.0-20240824084238-bbd62f5e0158 h1:zAlBqlv+ljSO0AOvHQo2ur/MiCZFdwMYPVf7Hu0vezE=
|
||||
github.com/v03413/tronprotocol v0.0.0-20240824084238-bbd62f5e0158/go.mod h1:ToWfuVvvk9OTE5i0nisoXPWxVdeBdEduj7ddlwf/s9M=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
|
||||
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
|
||||
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
|
||||
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
|
||||
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
|
||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240823204242-4ba0660f739c h1:e0zB268kOca6FbuJkYUGxfwG4DKFZG/8DLyv9Zv66cE=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240823204242-4ba0660f739c/go.mod h1:fO8wJzT2zbQbAjbIoos1285VfEIYKDDY+Dt+WpTkh6g=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
|
||||
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
|
||||
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/driver/sqlite v1.5.4 h1:IqXwXi8M/ZlPzH/947tn5uik3aYQslP9BVveoax0nV0=
|
||||
gorm.io/driver/sqlite v1.5.4/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4=
|
||||
gorm.io/gorm v1.25.4 h1:iyNd8fNAe8W9dvtlgeRI5zSVZPsq3OpcTu37cYcpCmw=
|
||||
gorm.io/gorm v1.25.4/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
|
||||
gorm.io/gorm v1.25.10 h1:dQpO+33KalOA+aFYGlK+EfxcI5MbO7EP2yYygwh9h+s=
|
||||
gorm.io/gorm v1.25.10/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
||||
modernc.org/libc v1.41.0 h1:g9YAc6BkKlgORsUWj+JwqoB1wU3o4DE3bM3yvA3k+Gk=
|
||||
modernc.org/libc v1.41.0/go.mod h1:w0eszPsiXoOnoMJgrXjglgLuDy/bt5RR4y3QzUUeodY=
|
||||
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
|
||||
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
|
||||
modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E=
|
||||
modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E=
|
||||
modernc.org/sqlite v1.29.1 h1:19GY2qvWB4VPw0HppFlZCPAbmxFU41r+qjKZQdQ1ryA=
|
||||
modernc.org/sqlite v1.29.1/go.mod h1:hG41jCYxOAOoO6BRK66AdRlmOcDzXf7qnwlwjUIOqa0=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
|
||||
+4
-4
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
// Version 版本号说明 1.0.0 代表主版本号.功能版本号.修订号
|
||||
const Version = "1.8.20"
|
||||
const Version = "1.10.27"
|
||||
|
||||
func main() {
|
||||
if err := model.Init(); err != nil {
|
||||
@@ -31,12 +31,12 @@ func main() {
|
||||
// 启动汇率监控
|
||||
go monitor.OkxUsdtRateStart()
|
||||
|
||||
// 启动交易监控
|
||||
go monitor.TradeStart()
|
||||
|
||||
// 启动回调监控
|
||||
go monitor.NotifyStart()
|
||||
|
||||
// 启动区块扫描
|
||||
go monitor.BlockScanStart()
|
||||
|
||||
// 启动web服务
|
||||
go web.Start()
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<p>Powered by <a href="https://github.com/v03413/bepusdt" target="_blank">莫名 - Bepusdt</a></p>
|
||||
<p>Powered by <a href="https://github.com/v03413/bepusdt" target="_blank">v03413 - Bepusdt -</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/js/jquery.min.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user