Address Contract Verified
Address
0x5d016a9110767307d83C8F6ee5e068D7720d76Cf
Balance
0 ETH
Nonce
1
Code Size
2134 bytes
Creator
0xe3b9bda1...196b at tx 0x2dbc06ed...46d2c3
Indexed Transactions
0
Contract Bytecode
2134 bytes
0x60806040526004361061007b5760003560e01c80638da5cb5b1161004e5780638da5cb5b1461011a578063be3397e914610138578063eef21cd21461014b578063f2fde38b1461016b57600080fd5b8063108e6cfc146100805780631f596f89146100ab578063715018a6146100e3578063747293fb146100fa575b600080fd5b34801561008c57600080fd5b5061009561018b565b6040516100a291906105b1565b60405180910390f35b3480156100b757600080fd5b506100cb6100c63660046106aa565b61019c565b6040516001600160a01b0390911681526020016100a2565b3480156100ef57600080fd5b506100f861023f565b005b34801561010657600080fd5b506100f86101153660046106f4565b610253565b34801561012657600080fd5b506000546001600160a01b03166100cb565b6100cb610146366004610711565b610289565b34801561015757600080fd5b506100f86101663660046106f4565b610349565b34801561017757600080fd5b506100f86101863660046106f4565b610379565b606061019760016103b9565b905090565b6000806101a8836103cd565b905060006101c0308360009182526020526040902090565b604051633676129b60e11b81526004810182905290915073ba5ed099633d3b313e4d5f7bdc1305d3c28ba5ed90636cec253690602401602060405180830381865afa158015610213573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102379190610789565b949350505050565b610247610452565b610251600061047f565b565b61025b610452565b6102666001826104cf565b610286576040516001623caaf760e01b0319815260040160405180910390fd5b50565b60006102966001336104e4565b6102b3576040516348f5c3ed60e01b815260040160405180910390fd5b60006102be846103cd565b604051634e1b514360e11b815290915073ba5ed099633d3b313e4d5f7bdc1305d3c28ba5ed90639c36a2869034906102fc90859088906004016107ca565b60206040518083038185885af115801561031a573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061033f9190610789565b9150505b92915050565b610351610452565b61035c6001826104cf565b610286576040516339a1a25760e11b815260040160405180910390fd5b610381610452565b6001600160a01b0381166103b057604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6102868161047f565b606060006103c683610506565b9392505050565b60008030836040516020016103e29190610804565b6040516020818303038152906040528051906020012060405160200161043792919060609290921b6bffffffffffffffffffffffff19168252600060148301526001600160a81b031916601582015260200190565b60408051601f19818403018152919052602001519392505050565b6000546001600160a01b031633146102515760405163118cdaa760e01b81523360048201526024016103a7565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006103c6836001600160a01b038416610562565b6001600160a01b038116600090815260018301602052604081205415156103c6565b60608160000180548060200260200160405190810160405280929190818152602001828054801561055657602002820191906000526020600020905b815481526020019060010190808311610542575b50505050509050919050565b60008181526001830160205260408120546105a957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610343565b506000610343565b6020808252825182820181905260009190848201906040850190845b818110156105f25783516001600160a01b0316835292840192918401916001016105cd565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561062f5761062f6105fe565b604051601f8501601f19908116603f01168101908282118183101715610657576106576105fe565b8160405280935085815286868601111561067057600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261069b57600080fd5b6103c683833560208501610614565b6000602082840312156106bc57600080fd5b813567ffffffffffffffff8111156106d357600080fd5b61033f8482850161068a565b6001600160a01b038116811461028657600080fd5b60006020828403121561070657600080fd5b81356103c6816106df565b6000806040838503121561072457600080fd5b823567ffffffffffffffff8082111561073c57600080fd5b6107488683870161068a565b9350602085013591508082111561075e57600080fd5b508301601f8101851361077057600080fd5b61077f85823560208401610614565b9150509250929050565b60006020828403121561079b57600080fd5b81516103c6816106df565b60005b838110156107c15781810151838201526020016107a9565b50506000910152565b82815260406020820152600082518060408401526107ef8160608501602087016107a6565b601f01601f1916919091016060019392505050565b600082516108168184602087016107a6565b919091019291505056fea264697066735822122072d50d1002f1274cdba2149cc382ecf6df4da5f529c4e8ec83093bcd9e44efef64736f6c63430008170033
Verified Source Code Full Match
Compiler: v0.8.23+commit.f704f362
EVM: paris
Optimization: Yes (200 runs)
ICreateX.sol 153 lines
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.23;
/**
* @title CreateX Factory Interface Definition
* @author pcaversaccio (https://web.archive.org/web/20230921103111/https://pcaversaccio.com/)
* @custom:coauthor Matt Solomon (https://web.archive.org/web/20230921103335/https://mattsolomon.dev/)
*/
interface ICreateX {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* TYPES */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
struct Values {
uint256 constructorAmount;
uint256 initCallAmount;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EVENTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
event ContractCreation(address indexed newContract, bytes32 indexed salt);
event ContractCreation(address indexed newContract);
event Create3ProxyContractCreation(address indexed newContract, bytes32 indexed salt);
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
error FailedContractCreation(address emitter);
error FailedContractInitialisation(address emitter, bytes revertData);
error InvalidSalt(address emitter);
error InvalidNonceValue(address emitter);
error FailedEtherTransfer(address emitter, bytes revertData);
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CREATE */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
function deployCreate(bytes memory initCode) external payable returns (address newContract);
function deployCreateAndInit(
bytes memory initCode,
bytes memory data,
Values memory values,
address refundAddress
) external payable returns (address newContract);
function deployCreateAndInit(
bytes memory initCode,
bytes memory data,
Values memory values
) external payable returns (address newContract);
function deployCreateClone(address implementation, bytes memory data) external payable returns (address proxy);
function computeCreateAddress(address deployer, uint256 nonce) external view returns (address computedAddress);
function computeCreateAddress(uint256 nonce) external view returns (address computedAddress);
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CREATE2 */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
function deployCreate2(bytes32 salt, bytes memory initCode) external payable returns (address newContract);
function deployCreate2(bytes memory initCode) external payable returns (address newContract);
function deployCreate2AndInit(
bytes32 salt,
bytes memory initCode,
bytes memory data,
Values memory values,
address refundAddress
) external payable returns (address newContract);
function deployCreate2AndInit(
bytes32 salt,
bytes memory initCode,
bytes memory data,
Values memory values
) external payable returns (address newContract);
function deployCreate2AndInit(
bytes memory initCode,
bytes memory data,
Values memory values,
address refundAddress
) external payable returns (address newContract);
function deployCreate2AndInit(
bytes memory initCode,
bytes memory data,
Values memory values
) external payable returns (address newContract);
function deployCreate2Clone(
bytes32 salt,
address implementation,
bytes memory data
) external payable returns (address proxy);
function deployCreate2Clone(address implementation, bytes memory data) external payable returns (address proxy);
function computeCreate2Address(
bytes32 salt,
bytes32 initCodeHash,
address deployer
) external pure returns (address computedAddress);
function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) external view returns (address computedAddress);
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CREATE3 */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
function deployCreate3(bytes32 salt, bytes memory initCode) external payable returns (address newContract);
function deployCreate3(bytes memory initCode) external payable returns (address newContract);
function deployCreate3AndInit(
bytes32 salt,
bytes memory initCode,
bytes memory data,
Values memory values,
address refundAddress
) external payable returns (address newContract);
function deployCreate3AndInit(
bytes32 salt,
bytes memory initCode,
bytes memory data,
Values memory values
) external payable returns (address newContract);
function deployCreate3AndInit(
bytes memory initCode,
bytes memory data,
Values memory values,
address refundAddress
) external payable returns (address newContract);
function deployCreate3AndInit(
bytes memory initCode,
bytes memory data,
Values memory values
) external payable returns (address newContract);
function computeCreate3Address(bytes32 salt, address deployer) external pure returns (address computedAddress);
function computeCreate3Address(bytes32 salt) external view returns (address computedAddress);
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
EnumerableSet.sol 378 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.20;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position is the index of the value in the `values` array plus 1.
// Position 0 is used to mean a value is not in the set.
mapping(bytes32 value => uint256) _positions;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._positions[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We cache the value's position to prevent multiple reads from the same storage slot
uint256 position = set._positions[value];
if (position != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 valueIndex = position - 1;
uint256 lastIndex = set._values.length - 1;
if (valueIndex != lastIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the lastValue to the index where the value to delete is
set._values[valueIndex] = lastValue;
// Update the tracked position of the lastValue (that was just moved)
set._positions[lastValue] = position;
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the tracked position for the deleted slot
delete set._positions[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._positions[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}
Deployer3.sol 87 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {ICreateX} from "src/interfaces/external/ICreateX.sol";
/// @title Odyssey create3 deployer contract
/// @dev Allows having createx permissioned addresses dissociated from an unique EOA
contract Deployer3 is Ownable {
using EnumerableSet for EnumerableSet.AddressSet;
ICreateX constant CREATEX = ICreateX(0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed);
EnumerableSet.AddressSet _callers;
error InvalidCaller();
error CouldNotAddCaller();
error CouldNotRemoveCaller();
modifier onlyCaller() {
if (!_callers.contains(msg.sender)) revert InvalidCaller();
_;
}
constructor(address safe_) Ownable(safe_) {}
/// @notice Deploy a contract
/// @param salt_ The salt
/// @param initCode_ The target contract's init code
/// @return the address of the deployed contract
function deploy(string memory salt_, bytes memory initCode_) external payable onlyCaller returns (address) {
bytes32 _salt = _toCreateXSalt(salt_);
return CREATEX.deployCreate3{value: msg.value}(_salt, initCode_);
}
/// @notice Compute the create3 address for a given salt
/// @param salt_ The salt
/// @return the computed address
function computeAddress(string memory salt_) external view returns (address) {
bytes32 _salt = _toCreateXSalt(salt_);
bytes32 _guardedSalt = _efficientHash({a: bytes32(uint256(uint160(address(this)))), b: _salt});
return CREATEX.computeCreate3Address(_guardedSalt);
}
/// @notice Get the allowed callers list
function callers() external view returns (address[] memory) {
return _callers.values();
}
/// @notice Add an address as an allowed caller
function addCaller(address caller_) external onlyOwner {
if (!_callers.add(caller_)) revert CouldNotAddCaller();
}
/// @notice Remote an address from the allowed callers list
function removeCaller(address caller_) external onlyOwner {
if (!_callers.add(caller_)) revert CouldNotRemoveCaller();
}
/// @dev Parse string salt to CreateX's salt format
/// @param salt_ The salt string
/// @return _salt CreateX salt
function _toCreateXSalt(string memory salt_) private view returns (bytes32 _salt) {
// The actual CreateX's salt has 32 bytes and holds some setup
// 20 bytes: if non-zero, introduces the sender's address to the actual salt (permissioned)
// 1 byte : if true, the chainId will be added to the actual salt ensuring unique address per chain
// 11 bytes: the first 11 bytes from the user's salt hash
bytes memory _inBytes = abi.encodePacked(address(this), hex"00", bytes11(keccak256(abi.encodePacked(salt_))));
assembly {
_salt := mload(add(_inBytes, 32))
}
}
/// @dev Returns the `keccak256` hash of `a` and `b` after concatenation.
/// @param a The first 32-byte value to be concatenated and hashed.
/// @param b The second 32-byte value to be concatenated and hashed.
/// @return hash The 32-byte `keccak256` hash of `a` and `b`.
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 hash) {
assembly ("memory-safe") {
mstore(0x00, a)
mstore(0x20, b)
hash := keccak256(0x00, 0x40)
}
}
}
Read Contract
callers 0x108e6cfc → address[]
computeAddress 0x1f596f89 → address
owner 0x8da5cb5b → address
Write Contract 5 functions
These functions modify contract state and require a wallet transaction to execute.
addCaller 0x747293fb
address caller_
deploy 0xbe3397e9
string salt_
bytes initCode_
returns: address
removeCaller 0xeef21cd2
address caller_
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address