-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2852 from irisnet/dreamer/refator-evm
refactor: fix eip712 signature and inject ParseChainID method
- Loading branch information
Showing
8 changed files
with
123 additions
and
66 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
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
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
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 |
---|---|---|
@@ -1,29 +1,18 @@ | ||
package types | ||
|
||
import ( | ||
"fmt" | ||
"math/big" | ||
"strings" | ||
|
||
etherminttypes "github.com/evmos/ethermint/types" | ||
) | ||
|
||
var ( | ||
EIP155ChainID = "6688" | ||
) | ||
|
||
func BuildEthChainID(chainID string) string { | ||
if etherminttypes.IsValidChainID(chainID) { | ||
return chainID | ||
} | ||
|
||
func parseChainID(_ string) (*big.Int, error) { | ||
eip155ChainID, ok := new(big.Int).SetString(EIP155ChainID, 10) | ||
if !ok { | ||
panic("invalid chain-id: " + EIP155ChainID) | ||
} | ||
|
||
chains := strings.Split(chainID, "-") | ||
if len(chains) != 2 { | ||
panic("invalid chain-id: " + chainID) | ||
return nil, fmt.Errorf("invalid chain-id: %s" + EIP155ChainID) | ||
} | ||
return chains[0] + "_" + eip155ChainID.String() + "-" + chains[1] | ||
return eip155ChainID, nil | ||
} |
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