forked from 0xPolygonHermez/zkevm-bridge-service
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
weiqiang.fan
committed
Feb 20, 2024
1 parent
83f4d34
commit ebd2f3a
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package utils | ||
|
||
var ( | ||
x1TestNetMapper = createChainIdMapper(19500, 195) | ||
This comment has been minimized.
Sorry, something went wrong.
trunghai95
Collaborator
|
||
//x1MainNetMapper = createChainIdMapper(196, 196) | ||
) | ||
|
||
type ChainIdMapper struct { | ||
InnerChainId uint64 | ||
ChainId uint64 | ||
} | ||
|
||
func createChainIdMapper(innerChainId uint64, chanId uint64) *ChainIdMapper { | ||
return &ChainIdMapper{ | ||
InnerChainId: innerChainId, | ||
ChainId: chanId, | ||
} | ||
} | ||
|
||
func GetChainIdByInnerId(innerChainId uint64) uint64 { | ||
if x1TestNetMapper.InnerChainId == innerChainId { | ||
return x1TestNetMapper.ChainId | ||
} | ||
//if x1MainNetMapper.InnerChainId == innerChainId { | ||
// return x1MainNetMapper.ChainId | ||
//} | ||
return innerChainId | ||
} | ||
|
||
func GetInnerChainIdByChainId(chainId uint64) uint64 { | ||
if x1TestNetMapper.ChainId == chainId { | ||
return x1TestNetMapper.InnerChainId | ||
} | ||
//if x1MainNetMapper.ChainId == chainId { | ||
// return x1MainNetMapper.InnerChainId | ||
//} | ||
return chainId | ||
} |
@fanweiqiang Will it affect other modules too? (currently we're also using chain ids in "main coins" and "get transactions" modules)