Skip to content

Commit

Permalink
simplify script
Browse files Browse the repository at this point in the history
  • Loading branch information
oveddan committed Sep 21, 2023
1 parent 7fd11ab commit 2ea47eb
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions script/GetDeterminsticParam.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ import {LibString} from "solady/utils/LibString.sol";
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";

contract GetDeterminsticParam is ZoraDeployerBase {
function stringToUint(string memory s) public pure returns (uint) {
bytes memory b = bytes(s);
uint result = 0;
for (uint256 i = 0; i < b.length; i++) {
uint256 c = uint256(uint8(b[i]));
if (c >= 48 && c <= 57) {
result = result * 10 + (c - 48);
}
}
return result;
}

// copied from: https://github.com/karmacoma-eth/foundry-playground/blob/main/script/MineSaltScript.sol#L17C1-L36C9
function mineSalt(address deployer, bytes32 initCodeHash, string memory startsWith) public returns (string memory saltStr, address expectedAddress) {
string[] memory args = new string[](8);
Expand Down Expand Up @@ -70,12 +58,5 @@ contract GetDeterminsticParam is ZoraDeployerBase {

console.log("salt: ", saltString);
console.log("expected address: ", expectedAddress);

address addressFromSalt = Create2.computeAddress(bytes32(stringToUint(saltString)), creationCodeHash, deployerAddress);

console.log("resulting address from salt: ", expectedAddress);

// make sure they are equal:
assert(addressFromSalt == expectedAddress);
}
}

0 comments on commit 2ea47eb

Please sign in to comment.