Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 12 additions & 4 deletions script/DeployBatchCaller.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,29 @@ import "forge-std/Vm.sol";
import "src/BatchCallAndSponsor.sol";
import "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";
import "lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol";
import "lib/openzeppelin-contracts/contracts/utils/Create2.sol";

contract DeployBatchCaller is Script {
BatchCallAndSponsor public batchCaller;
// This salt will be used for CREATE2 deployment
bytes32 public constant SALT = keccak256("BatchCallAndSponsor-v1");

function run() external {
uint256 deployerPk = vm.envUint("DEPLOYER_KEY");
address deployer = vm.addr(deployerPk);
console.log("Deployer:", deployer);
// Get the bytecode of the contract
bytes memory bytecode = type(BatchCallAndSponsor).creationCode;

// Start broadcasting transactions with Alice's private key.
vm.startBroadcast(deployerPk);

// Deploy the delegation contract (Alice will delegate calls to this contract).
batchCaller = new BatchCallAndSponsor();
// Deploy using CREATE2
address payable deployedAddress = payable(Create2.deploy(0, SALT, bytecode));

// Cast the deployed address to BatchCallAndSponsor
batchCaller = BatchCallAndSponsor(deployedAddress);

vm.stopBroadcast();
// Log the deployed address
console2.log("BatchCallAndSponsor deployed to:", deployedAddress);
}
}
17 changes: 16 additions & 1 deletion script/DeployMultisend.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,32 @@ import "forge-std/Vm.sol";
import "src/EOAMultisend.sol";
import "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";
import "lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol";
import "lib/openzeppelin-contracts/contracts/utils/Create2.sol";

contract DeployMultisend is Script {
EOAMultisend public multisend;

// This salt will be used for CREATE2 deployment
// Using a constant salt ensures the same address across all networks
bytes32 public constant SALT = keccak256("EOAMultisend-v1");

function run() external {
uint256 deployerPk = vm.envUint("DEPLOYER_KEY");

vm.startBroadcast(deployerPk);

multisend = new EOAMultisend();
// Get the bytecode of the contract
bytes memory bytecode = type(EOAMultisend).creationCode;

// Deploy using CREATE2
address payable deployedAddress = payable(Create2.deploy(0, SALT, bytecode));

// Cast the deployed address to EOAMultisend
multisend = EOAMultisend(deployedAddress);

vm.stopBroadcast();

// Log the deployed address
console2.log("EOAMultisend deployed to:", deployedAddress);
}
}