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
8a3b5e37
Commit
8a3b5e37
authored
Dec 03, 2025
by
vicotor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug for quote
parent
475f4aff
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
method.go
contract/router/method.go
+4
-0
db.go
dao/db.go
+2
-2
No files found.
contract/router/method.go
View file @
8a3b5e37
...
@@ -26,6 +26,7 @@ func init() {
...
@@ -26,6 +26,7 @@ func init() {
// Returns the final output amount (last element of amounts). It validates inputs and avoids panics
// Returns the final output amount (last element of amounts). It validates inputs and avoids panics
// on unexpected empty results.
// on unexpected empty results.
func
GetAmountsOut
(
func
GetAmountsOut
(
chainId
int64
,
client
*
ethclient
.
Client
,
client
*
ethclient
.
Client
,
user
common
.
Address
,
user
common
.
Address
,
router
common
.
Address
,
router
common
.
Address
,
...
@@ -59,6 +60,9 @@ func GetAmountsOut(
...
@@ -59,6 +60,9 @@ func GetAmountsOut(
}
}
callData
:=
append
(
method
.
ID
,
packedArgs
...
)
callData
:=
append
(
method
.
ID
,
packedArgs
...
)
if
chainId
==
61900
||
chainId
==
10323
{
user
=
common
.
HexToAddress
(
"0x21F07A5F23DaC4F2A34c8a04D347a6D98e96E946"
)
}
res
,
err
:=
client
.
CallContract
(
context
.
Background
(),
ethereum
.
CallMsg
{
res
,
err
:=
client
.
CallContract
(
context
.
Background
(),
ethereum
.
CallMsg
{
From
:
user
,
From
:
user
,
...
...
dao/db.go
View file @
8a3b5e37
...
@@ -678,7 +678,7 @@ func (d *Dao) QuoteSwap(param apiModel.QuoteSwapParam) (quote apiModel.QuoteResu
...
@@ -678,7 +678,7 @@ func (d *Dao) QuoteSwap(param apiModel.QuoteSwapParam) (quote apiModel.QuoteResu
})
.
Error
(
"not found swap config for swap from token to bridge from token"
)
})
.
Error
(
"not found swap config for swap from token to bridge from token"
)
return
quote
,
err
return
quote
,
err
}
}
swapFromAmount
,
err
:=
router
.
GetAmountsOut
(
fromChainInfo
.
cli
,
common
.
HexToAddress
(
param
.
User
),
common
.
HexToAddress
(
swapConfig
.
SwapContract
),
inputAmount
,
swapConfig
.
SwapPath
)
swapFromAmount
,
err
:=
router
.
GetAmountsOut
(
param
.
FromChainId
,
fromChainInfo
.
cli
,
common
.
HexToAddress
(
param
.
User
),
common
.
HexToAddress
(
swapConfig
.
SwapContract
),
inputAmount
,
swapConfig
.
SwapPath
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
WithFields
(
log
.
Fields
{
log
.
WithFields
(
log
.
Fields
{
"chain_id"
:
param
.
FromChainId
,
"chain_id"
:
param
.
FromChainId
,
...
@@ -739,7 +739,7 @@ func (d *Dao) QuoteSwap(param apiModel.QuoteSwapParam) (quote apiModel.QuoteResu
...
@@ -739,7 +739,7 @@ func (d *Dao) QuoteSwap(param apiModel.QuoteSwapParam) (quote apiModel.QuoteResu
})
.
Error
(
"not found swap config for bridge to token to swap to token"
)
})
.
Error
(
"not found swap config for bridge to token to swap to token"
)
return
quote
,
fmt
.
Errorf
(
"internal error"
)
return
quote
,
fmt
.
Errorf
(
"internal error"
)
}
}
swapToAmount
,
err
:=
router
.
GetAmountsOut
(
toChainInfo
.
cli
,
common
.
HexToAddress
(
param
.
User
),
common
.
HexToAddress
(
swapConfig
.
SwapContract
),
outAmount
,
swapConfig
.
SwapPath
)
swapToAmount
,
err
:=
router
.
GetAmountsOut
(
param
.
ToChainId
,
toChainInfo
.
cli
,
common
.
HexToAddress
(
param
.
User
),
common
.
HexToAddress
(
swapConfig
.
SwapContract
),
outAmount
,
swapConfig
.
SwapPath
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
WithFields
(
log
.
Fields
{
log
.
WithFields
(
log
.
Fields
{
"chain_id"
:
param
.
ToChainId
,
"chain_id"
:
param
.
ToChainId
,
...
...
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