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

Add NatSpecs to Create2 library #11250

Merged
merged 3 commits into from
Oct 16, 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
16 changes: 16 additions & 0 deletions packages/protocol/contracts/common/Create2.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
pragma solidity ^0.5.13;

/**
* @title Used for deploying contracts using the CREATE2 opcode.
*/
library Create2 {
/**
* @notice Deploys a contract with CREATE2.
* @param salt The CREATE2 salt.
* @param initCode The contract init code to use for deployment.
* @return Address of the deployed contract.
*/
function deploy(bytes32 salt, bytes memory initCode) internal returns (address) {
address deployedAddress;
assembly {
Expand All @@ -12,6 +21,13 @@ library Create2 {
return deployedAddress;
}

/**
* @notice Computes the CREATE2 address for given inputs.
* @param deployer Address of the deployer.
* @param salt The CREATE2 salt.
* @param initCodeHash Hash of the init code used for deployment.
* @return The address at which such a contract would be deployed.
*/
function computeAddress(
address deployer,
bytes32 salt,
Expand Down
Loading