Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
token-bridge
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
token-bridge
Commits
f68a1f7b
Commit
f68a1f7b
authored
Nov 19, 2025
by
vicotor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test
parent
082c1ed4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
builder_test.go
dao/builder_test.go
+37
-0
No files found.
dao/builder_test.go
0 → 100644
View file @
f68a1f7b
package
dao
import
(
"code.wuban.net.cn/movabridge/token-bridge/contract/bridge"
"context"
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"testing"
)
func
TestParseTransferLog
(
t
*
testing
.
T
)
{
url
:=
"https://bsc-rpc.publicnode.com"
txhash
:=
"0x8765c23729f5e93ef6485d6589fb58f58c0fb50af7009cfcd646d98664cd61f9"
contractAddr
:=
"0x214C0b3d19ad265c258DeA678Cf1f5a63499c0d9"
client
,
err
:=
ethclient
.
Dial
(
url
)
if
err
!=
nil
{
t
.
Fatalf
(
"failed to connect to the Ethereum client: %v"
,
err
)
}
contract
,
err
:=
bridge
.
NewBridgeContract
(
common
.
HexToAddress
(
contractAddr
),
client
)
if
err
!=
nil
{
t
.
Fatalf
(
"failed to instantiate a Bridge contract: %v"
,
err
)
}
receipt
,
err
:=
client
.
TransactionReceipt
(
context
.
TODO
(),
common
.
HexToHash
(
txhash
))
if
err
!=
nil
{
t
.
Fatalf
(
"failed to get transaction receipt: %v"
,
err
)
}
for
_
,
vLog
:=
range
receipt
.
Logs
{
if
vLog
.
Topics
[
0
]
.
Hex
()
==
TransferOutEvent
.
ID
.
Hex
()
{
event
,
err
:=
contract
.
ParseTransferOut
(
*
vLog
)
if
err
!=
nil
{
t
.
Fatalf
(
"failed to parse TransferOut log: %v"
,
err
)
}
fmt
.
Printf
(
"TransferOut event: %+v"
,
event
)
}
}
}
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