2020-01-23 16:39:15 +00:00
|
|
|
contract B
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
contract A {
|
|
|
|
function different_salt() public returns (bool) {
|
|
|
|
B x = new B{salt: "abc"}();
|
|
|
|
B y = new B{salt: "abcef"}();
|
|
|
|
return x != y;
|
|
|
|
}
|
|
|
|
function same_salt() public returns (bool) {
|
|
|
|
B x = new B{salt: "xyz"}();
|
|
|
|
try new B{salt: "xyz"}() {} catch {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ====
|
|
|
|
// EVMVersion: >=constantinople
|
2021-02-12 12:45:15 +00:00
|
|
|
// compileViaYul: also
|
2020-01-23 16:39:15 +00:00
|
|
|
// ----
|
|
|
|
// different_salt() -> true
|
|
|
|
// same_salt() -> true
|
2021-09-15 15:01:40 +00:00
|
|
|
// gas irOptimized: 98438914
|
2021-02-12 12:45:15 +00:00
|
|
|
// gas legacy: 98439116
|
2021-03-15 18:29:41 +00:00
|
|
|
// gas legacyOptimized: 98438970
|