dendrite/zion/util_converters.go
Tak Wai Wong 982ce71aad fix dendrite to interact with v1 / v2 contracts (#1155)
dendrite uses commandline flag v1 or v2 to choose the smart contracts for the isEntitled check
2022-12-29 15:37:03 -08:00

19 lines
357 B
Go

package zion
import (
"github.com/ethereum/go-ethereum/crypto"
)
func NetworkIdToHash(networkId string) [32]byte {
hash := crypto.Keccak256Hash([]byte(networkId))
return sliceBytesToBytes32(hash.Bytes())
}
func sliceBytesToBytes32(bytes []byte) [32]byte {
bytes32 := [32]byte{}
for i := 0; i < 32; i++ {
bytes32[i] = bytes[i]
}
return bytes32
}