Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Salt Fixes #208

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions script/salts/test/TestSalts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {MockCallback} from "test/callbacks/MockCallback.sol";
import {Callbacks} from "src/lib/Callbacks.sol";
import {CappedMerkleAllowlist} from "src/callbacks/allowlists/CappedMerkleAllowlist.sol";
import {AllocatedMerkleAllowlist} from "src/callbacks/allowlists/AllocatedMerkleAllowlist.sol";
import {UniswapV2DirectToLiquidity} from "src/callbacks/liquidity/UniswapV2DTL.sol";
import {UniswapV3DirectToLiquidity} from "src/callbacks/liquidity/UniswapV3DTL.sol";
// import {BaselineAxisLaunch} from "src/callbacks/liquidity/BaselineV2/BaselineAxisLaunch.sol";
Expand All @@ -26,6 +27,7 @@ import {TestConstants} from "test/Constants.sol";
contract TestSalts is Script, WithEnvironment, Permit2User, WithSalts, TestConstants {
string internal constant _MOCK_CALLBACK = "MockCallback";
string internal constant _CAPPED_MERKLE_ALLOWLIST = "CappedMerkleAllowlist";
string internal constant _ALLOCATED_MERKLE_ALLOWLIST = "AllocatedMerkleAllowlist";

function _setUp(string calldata chain_) internal {
_loadEnv(chain_);
Expand Down Expand Up @@ -411,6 +413,45 @@ contract TestSalts is Script, WithEnvironment, Permit2User, WithSalts, TestConst
_setTestSalt(bytecodePath, "90", _CAPPED_MERKLE_ALLOWLIST, bytecodeHash);
}

function generateAllocatedMerkleAllowlist() public {
// 10001000 = 0x88
bytes memory args = abi.encode(
_AUCTION_HOUSE,
Callbacks.Permissions({
onCreate: true,
onCancel: false,
onCurate: false,
onPurchase: false,
onBid: true,
onSettle: false,
receiveQuoteTokens: false,
sendBaseTokens: false
})
);
bytes memory contractCode = type(AllocatedMerkleAllowlist).creationCode;
(string memory bytecodePath, bytes32 bytecodeHash) =
_writeBytecode(_ALLOCATED_MERKLE_ALLOWLIST, contractCode, args);
_setTestSalt(bytecodePath, "88", _ALLOCATED_MERKLE_ALLOWLIST, bytecodeHash);

// 10010000 = 0x90
args = abi.encode(
_AUCTION_HOUSE,
Callbacks.Permissions({
onCreate: true,
onCancel: false,
onCurate: false,
onPurchase: true,
onBid: false,
onSettle: false,
receiveQuoteTokens: false,
sendBaseTokens: false
})
);
(bytecodePath, bytecodeHash) =
_writeBytecode(_ALLOCATED_MERKLE_ALLOWLIST, contractCode, args);
_setTestSalt(bytecodePath, "90", _ALLOCATED_MERKLE_ALLOWLIST, bytecodeHash);
}

function generateUniswapV2Router() public {
bytes memory args = abi.encode(_UNISWAP_V2_FACTORY, address(0));
bytes memory contractCode = type(UniswapV2Router02).creationCode;
Expand Down
Loading