Discover more of SonicScan Block Explorer's tools and services in one place.
Contract Source Code:
File 1 of 1 : BeefyContractDeployer
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract BeefyContractDeployer { event ContractDeployed(bytes32 indexed salt, address deploymentAddress); // Deploy a contract, if this address matches contract deployer on other chains it should match deployment address if salt/bytecode match., function deploy(bytes32 _salt, bytes memory _bytecode) external returns (address deploymentAddress) { address addr; assembly { addr := create2(0, add(_bytecode, 0x20), mload(_bytecode), _salt) if iszero(extcodesize(addr)) { revert(0, 0) } } emit ContractDeployed(_salt, addr); return addr; } // Get address by salt and bytecode. function getAddress(bytes32 _salt, bytes memory _bytecode) external view returns (address) { bytes32 hash = keccak256( abi.encodePacked( bytes1(0xff), address(this), _salt, keccak256(_bytecode) ) ); return address (uint160(uint(hash))); } // Creat salt by int or string. function createSalt(uint _num, string calldata _string) external pure returns (bytes32) { return _num > 0 ? keccak256(abi.encode(_num)) : keccak256(abi.encode(_string)); } }
Please enter a contract address above to load the contract details and source code.
Please DO NOT store any passwords or private keys here. A private note (up to 100 characters) can be saved and is useful for transaction tracking.
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.