Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- Deployer
- Optimization enabled
- true
- Compiler version
- v0.8.6+commit.11564f7e
- Optimization runs
- 1600
- EVM Version
- berlin
- Verified at
- 2026-03-26T23:24:36.901397Z
Constructor Arguments
8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e000000000000000000000000076eb574eff49fb64de6f7f2854952b05b5e24624
Arg [0] (address) : 0xd0a4f28419497f9722a3daafe3b4186f6b6457e0
contracts/governance/Deployer.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
pragma abicoder v2;
// OpenZeppelin v4
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Create2 } from "@openzeppelin/contracts/utils/Create2.sol";
/**
* @title Deployer
* @author Railgun Contributors
* @notice Deterministically deploys contracts with CREATE2
*/
contract Deployer is Ownable {
bytes1 private constant STARTING_BYTE = 0xff;
/**
* @notice Sets initial admin
*/
constructor(address _admin) {
Ownable.transferOwnership(_admin);
}
/**
* @notice Deploys contract via Create2
* @param _amount - ETH amount in wei
* if non-zero, bytecode must have payable constructor
* @param _salt - salt for deployment, bytecode+salt pair must
* not have been used to deploy before
* @param _bytecode - bytecode to deploy
* @return deployment - deployment address
*/
function deploy(
uint256 _amount,
bytes32 _salt,
bytes memory _bytecode
) external onlyOwner returns (address deployment) {
return Create2.deploy(_amount, _salt, _bytecode);
}
/**
* @notice Gets deployment address ahead of time
* @param _salt - salt
* @param _bytecodeHash - keccak256 bytecode hash
* @return deployment - deployment address
*/
function getAddress(
bytes32 _salt,
bytes32 _bytecodeHash
) public view returns (address deployment) {
// Note: We don't use openzeppelin's Create2 library here
// so that we can maintain compatibility with chains that
// have a different starting byte to Ethereum (0xff)
// Calculate deployment hash
bytes32 hash = keccak256(
abi.encodePacked(
STARTING_BYTE,
address(this),
_salt,
_bytecodeHash
)
);
// Cast last 20 bytes of hash to address
return address(uint160(uint256(hash)));
}
/**
* @notice Gets deployment address ahead of time
* @param _salt - salt
* @param _bytecode - bytecode
* @return deployment - deployment address
*/
function getAddressFromBytecode(
bytes32 _salt,
bytes calldata _bytecode
) external view returns (address deployment) {
// Get bytecode hash
bytes32 bytecodeHash = keccak256(_bytecode);
// Return address
return getAddress(_salt, bytecodeHash);
}
}
/Ownable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../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.
*
* By default, the owner account will be the one that deploys the contract. 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;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = 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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @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) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/Create2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
* `CREATE2` can be used to compute in advance the address where a smart
* contract will be deployed, which allows for interesting new mechanisms known
* as 'counterfactual interactions'.
*
* See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
* information.
*/
library Create2 {
/**
* @dev Deploys a contract using `CREATE2`. The address where the contract
* will be deployed can be known in advance via {computeAddress}.
*
* The bytecode for a contract can be obtained from Solidity with
* `type(contractName).creationCode`.
*
* Requirements:
*
* - `bytecode` must not be empty.
* - `salt` must have not been used for `bytecode` already.
* - the factory must have a balance of at least `amount`.
* - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
*/
function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address) {
address addr;
require(address(this).balance >= amount, "Create2: insufficient balance");
require(bytecode.length != 0, "Create2: bytecode length is zero");
// solhint-disable-next-line no-inline-assembly
assembly {
addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)
}
require(addr != address(0), "Create2: Failed on deploy");
return addr;
}
/**
* @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
* `bytecodeHash` or `salt` will result in a new destination address.
*/
function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {
return computeAddress(salt, bytecodeHash, address(this));
}
/**
* @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
* `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
*/
function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address) {
bytes32 _data = keccak256(
abi.encodePacked(bytes1(0xff), deployer, salt, bytecodeHash)
);
return address(uint160(uint256(_data)));
}
}
Compiler Settings
{"remappings":[],"optimizer":{"runs":1600,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"berlin","compilationTarget":{"contracts/governance/Deployer.sol":"Deployer"}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_admin","internalType":"address"}]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"address","name":"deployment","internalType":"address"}],"name":"deploy","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"bytes32","name":"_salt","internalType":"bytes32"},{"type":"bytes","name":"_bytecode","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"deployment","internalType":"address"}],"name":"getAddress","inputs":[{"type":"bytes32","name":"_salt","internalType":"bytes32"},{"type":"bytes32","name":"_bytecodeHash","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"deployment","internalType":"address"}],"name":"getAddressFromBytecode","inputs":[{"type":"bytes32","name":"_salt","internalType":"bytes32"},{"type":"bytes","name":"_bytecode","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b5060405161096038038061096083398101604081905261002f91610184565b600080546001600160a01b03191633908117825560405190918291600080516020610940833981519152908290a3506100718161007760201b61032b1760201c565b506101b4565b6000546001600160a01b031633146100d65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b03811661013b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016100cd565b600080546040516001600160a01b038085169392169160008051602061094083398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60006020828403121561019657600080fd5b81516001600160a01b03811681146101ad57600080fd5b9392505050565b61077d806101c36000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c80638da5cb5b116100505780638da5cb5b146100c3578063d3a39686146100d4578063f2fde38b1461015057600080fd5b80633e6943d61461007757806366cfa057146100a6578063715018a6146100b9575b600080fd5b61008a6100853660046105c8565b610163565b6040516001600160a01b03909116815260200160405180910390f35b61008a6100b4366004610644565b6101fc565b6100c161026f565b005b6000546001600160a01b031661008a565b61008a6100e23660046105a6565b604080517fff000000000000000000000000000000000000000000000000000000000000006020808301919091523060601b6bffffffffffffffffffffffff191660218301526035820194909452605580820193909352815180820390930183526075019052805191012090565b6100c161015e366004610576565b61032b565b6000808383604051610176929190610708565b604051809103902090506101f38582604080517fff000000000000000000000000000000000000000000000000000000000000006020808301919091523060601b6bffffffffffffffffffffffff191660218301526035820194909452605580820193909352815180820390930183526075019052805191012090565b95945050505050565b600080546001600160a01b0316331461025c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b610267848484610474565b949350505050565b6000546001600160a01b031633146102c95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610253565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6000546001600160a01b031633146103855760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610253565b6001600160a01b0381166104015760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610253565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600080844710156104c75760405162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610253565b82516105155760405162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610253565b8383516020850187f590506001600160a01b0381166102675760405162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610253565b60006020828403121561058857600080fd5b81356001600160a01b038116811461059f57600080fd5b9392505050565b600080604083850312156105b957600080fd5b50508035926020909101359150565b6000806000604084860312156105dd57600080fd5b83359250602084013567ffffffffffffffff808211156105fc57600080fd5b818601915086601f83011261061057600080fd5b81358181111561061f57600080fd5b87602082850101111561063157600080fd5b6020830194508093505050509250925092565b60008060006060848603121561065957600080fd5b8335925060208401359150604084013567ffffffffffffffff8082111561067f57600080fd5b818601915086601f83011261069357600080fd5b8135818111156106a5576106a5610718565b604051601f8201601f19908116603f011681019083821181831017156106cd576106cd610718565b816040528281528960208487010111156106e657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea2646970667358221220f9e1a6be9c725ddf8eb92cd0127c0a1aa0c08091b0d27827bda20598d17b48a864736f6c634300080600338be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e000000000000000000000000076eb574eff49fb64de6f7f2854952b05b5e24624
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100725760003560e01c80638da5cb5b116100505780638da5cb5b146100c3578063d3a39686146100d4578063f2fde38b1461015057600080fd5b80633e6943d61461007757806366cfa057146100a6578063715018a6146100b9575b600080fd5b61008a6100853660046105c8565b610163565b6040516001600160a01b03909116815260200160405180910390f35b61008a6100b4366004610644565b6101fc565b6100c161026f565b005b6000546001600160a01b031661008a565b61008a6100e23660046105a6565b604080517fff000000000000000000000000000000000000000000000000000000000000006020808301919091523060601b6bffffffffffffffffffffffff191660218301526035820194909452605580820193909352815180820390930183526075019052805191012090565b6100c161015e366004610576565b61032b565b6000808383604051610176929190610708565b604051809103902090506101f38582604080517fff000000000000000000000000000000000000000000000000000000000000006020808301919091523060601b6bffffffffffffffffffffffff191660218301526035820194909452605580820193909352815180820390930183526075019052805191012090565b95945050505050565b600080546001600160a01b0316331461025c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b610267848484610474565b949350505050565b6000546001600160a01b031633146102c95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610253565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6000546001600160a01b031633146103855760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610253565b6001600160a01b0381166104015760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610253565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600080844710156104c75760405162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610253565b82516105155760405162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610253565b8383516020850187f590506001600160a01b0381166102675760405162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610253565b60006020828403121561058857600080fd5b81356001600160a01b038116811461059f57600080fd5b9392505050565b600080604083850312156105b957600080fd5b50508035926020909101359150565b6000806000604084860312156105dd57600080fd5b83359250602084013567ffffffffffffffff808211156105fc57600080fd5b818601915086601f83011261061057600080fd5b81358181111561061f57600080fd5b87602082850101111561063157600080fd5b6020830194508093505050509250925092565b60008060006060848603121561065957600080fd5b8335925060208401359150604084013567ffffffffffffffff8082111561067f57600080fd5b818601915086601f83011261069357600080fd5b8135818111156106a5576106a5610718565b604051601f8201601f19908116603f011681019083821181831017156106cd576106cd610718565b816040528281528960208487010111156106e657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea2646970667358221220f9e1a6be9c725ddf8eb92cd0127c0a1aa0c08091b0d27827bda20598d17b48a864736f6c63430008060033