getCreate2Address function
Implementation
EthereumAddress getCreate2Address(
String from, String salt, String initCodeHash) {
if (hexToBytes(initCodeHash).length != 32) {
throw ArgumentError("initCodeHash must be 32 bytes $initCodeHash");
}
var startBytes = hexToBytes('0xff');
var factoryBytes = hexToBytes(from);
var saltBytes = keccak256(hexToBytes(salt));
var initCodeHashBytes = hexToBytes(initCodeHash);
return EthereumAddress(keccak256(Uint8List.fromList(
startBytes + factoryBytes + saltBytes + initCodeHashBytes))
.sublist(12));
}