solidity/test/libsolidity/semanticTests/salted_create/salted_create.sol

25 lines
502 B
Solidity
Raw Normal View History

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;
}
}
// ====
2020-11-11 16:38:56 +00:00
// compileViaYul: also
2020-01-23 16:39:15 +00:00
// EVMVersion: >=constantinople
// ----
// different_salt() -> true
// same_salt() -> true