Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bridge-backend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
movabridge
bridge-backend
Commits
d7eccbcb
Commit
d7eccbcb
authored
Feb 02, 2026
by
vicotor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add coin support
parent
8a3b5e37
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
constant.go
constant/constant.go
+2
-0
tokenrepo.go
tokenrepo/tokenrepo.go
+28
-0
No files found.
constant/constant.go
View file @
d7eccbcb
...
...
@@ -4,6 +4,8 @@ import "fmt"
const
JwtSecret
=
"uEj7AgDNCREwsvnTaCEtzDXt0I5eFDl8"
const
CoinAddress
=
"0x0000000000000000000000000000000000000001"
const
(
InvalidParam
=
"invalid param"
UnsupportedPlatform
=
"unsupported platform"
...
...
tokenrepo/tokenrepo.go
View file @
d7eccbcb
...
...
@@ -2,6 +2,7 @@ package tokenrepo
import
(
"code.wuban.net.cn/movabridge/bridge-backend/chainlist"
"code.wuban.net.cn/movabridge/bridge-backend/constant"
"code.wuban.net.cn/movabridge/bridge-backend/contract/token"
"context"
"errors"
...
...
@@ -50,6 +51,16 @@ func (tr *TokenRepo) RetriveTokenInfo(chainId int64, address string) (TokenInfo,
if
info
,
ok
:=
tr
.
GetTokenInfo
(
address
);
ok
{
return
info
,
nil
}
if
strings
.
Compare
(
strings
.
ToLower
(
address
),
strings
.
ToLower
(
constant
.
CoinAddress
))
==
0
{
info
:=
TokenInfo
{
Name
:
"MOVA"
,
Symbol
:
"MOVA"
,
Decimals
:
18
,
Address
:
address
,
}
tr
.
SetTokenInfo
(
address
,
info
)
return
info
,
nil
}
chain
,
ok
:=
tr
.
chainRepo
.
Get
(
chainId
)
if
!
ok
{
return
TokenInfo
{},
errors
.
New
(
"chain not found"
)
...
...
@@ -94,6 +105,23 @@ func (tr *TokenRepo) RetriveTokenInfoAndBalance(client *ethclient.Client, addres
info
:=
TokenInfo
{}
balance
:=
big
.
NewInt
(
0
)
if
strings
.
Compare
(
strings
.
ToLower
(
address
),
strings
.
ToLower
(
constant
.
CoinAddress
))
==
0
{
info
=
TokenInfo
{
Name
:
"MOVA"
,
Symbol
:
"MOVA"
,
Decimals
:
18
,
Address
:
address
,
}
tr
.
SetTokenInfo
(
address
,
info
)
userBalance
,
err
:=
client
.
BalanceAt
(
context
.
Background
(),
common
.
HexToAddress
(
user
),
nil
)
if
err
!=
nil
{
return
info
,
balance
,
err
}
else
{
balance
=
userBalance
}
return
info
,
balance
,
nil
}
contract
,
err
:=
token
.
NewTokenCaller
(
common
.
HexToAddress
(
address
),
client
)
if
err
!=
nil
{
return
info
,
balance
,
fmt
.
Errorf
(
"fail to connect contract err: %v"
,
err
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment